Changeset 391 for python/trunk/Lib/test/test_codeop.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_codeop.py
r2 r391 24 24 if is_jython: 25 25 code = compile_command(str, "<input>", symbol) 26 self.assert _(code)26 self.assertTrue(code) 27 27 if symbol == "single": 28 28 d,r = {},{} … … 38 38 d = { 'value': eval(code,ctx) } 39 39 r = { 'value': eval(str,ctx) } 40 self.assertEqual s(unify_callables(r),unify_callables(d))40 self.assertEqual(unify_callables(r),unify_callables(d)) 41 41 else: 42 42 expected = compile(str, "<input>", symbol, PyCF_DONT_IMPLY_DEDENT) 43 self.assertEqual s(compile_command(str, "<input>", symbol), expected)43 self.assertEqual(compile_command(str, "<input>", symbol), expected) 44 44 45 45 def assertIncomplete(self, str, symbol='single'): 46 46 '''succeed iff str is the start of a valid piece of code''' 47 self.assertEqual s(compile_command(str, symbol=symbol), None)47 self.assertEqual(compile_command(str, symbol=symbol), None) 48 48 49 49 def assertInvalid(self, str, symbol='single', is_syntax=1): … … 51 51 try: 52 52 compile_command(str,symbol=symbol) 53 self.fail("No exception thrownfor invalid code")53 self.fail("No exception raised for invalid code") 54 54 except SyntaxError: 55 self.assert _(is_syntax)55 self.assertTrue(is_syntax) 56 56 except OverflowError: 57 self.assert _(not is_syntax)57 self.assertTrue(not is_syntax) 58 58 59 59 def test_valid(self): … … 62 62 # special case 63 63 if not is_jython: 64 self.assertEqual s(compile_command(""),65 compile("pass", "<input>", 'single',66 PyCF_DONT_IMPLY_DEDENT))67 self.assertEqual s(compile_command("\n"),68 compile("pass", "<input>", 'single',69 PyCF_DONT_IMPLY_DEDENT))64 self.assertEqual(compile_command(""), 65 compile("pass", "<input>", 'single', 66 PyCF_DONT_IMPLY_DEDENT)) 67 self.assertEqual(compile_command("\n"), 68 compile("pass", "<input>", 'single', 69 PyCF_DONT_IMPLY_DEDENT)) 70 70 else: 71 71 av("") … … 291 291 292 292 def test_filename(self): 293 self.assertEquals(compile_command("a = 1\n", "abc").co_filename, 294 compile("a = 1\n", "abc", 'single').co_filename) 295 self.assertNotEquals(compile_command("a = 1\n", "abc").co_filename, 296 compile("a = 1\n", "def", 'single').co_filename) 297 298 def test_no_universal_newlines(self): 299 code = compile_command("'\rfoo\r'", symbol='eval') 300 self.assertEqual(eval(code), '\rfoo\r') 293 self.assertEqual(compile_command("a = 1\n", "abc").co_filename, 294 compile("a = 1\n", "abc", 'single').co_filename) 295 self.assertNotEqual(compile_command("a = 1\n", "abc").co_filename, 296 compile("a = 1\n", "def", 'single').co_filename) 301 297 302 298
Note:
See TracChangeset
for help on using the changeset viewer.