Source

rope_py3k / ropetest / codeanalyzetest.py

Diff from to

ropetest/codeanalyzetest.py

         self.assertEquals('a_var.an_attr', self._find_primary(code, 10))
 
     def test_word_finder_on_word_beginning(self):
-        code = 'print a_var\n'
+        code = 'print(a_var)\n'
         word_finder = worder.Worder(code)
         result = word_finder.get_word_at(code.index('a_var'))
         self.assertEquals('a_var', result)
 
     def test_word_finder_on_primary_beginning(self):
-        code = 'print a_var\n'
+        code = 'print(a_var)\n'
         result = self._find_primary(code, code.index('a_var'))
         self.assertEquals('a_var', result)
 
     def test_word_finder_on_word_ending(self):
-        code = 'print a_var\n'
+        code = 'print(a_var)\n'
         word_finder = worder.Worder(code)
         result = word_finder.get_word_at(code.index('a_var') + 5)
         self.assertEquals('a_var', result)
 
     def test_word_finder_on_primary_ending(self):
-        code = 'print a_var\n'
+        code = 'print(a_var)\n'
         result = self._find_primary(code, code.index('a_var') + 5)
         self.assertEquals('a_var', result)
 
                           self._find_primary(code, 25))
 
     def test_dictionaries(self):
-        code = 'print {1: "one", 2: "two"}.keys()'
+        code = 'print({1: "one", 2: "two"}.keys())'
         self.assertEquals('{1: "one", 2: "two"}.keys',
                           self._find_primary(code, 29))
 
         name_finder.get_pyname_at(code.index('pass'))
 
     def test_one_liners(self):
-        code = 'var = 1\ndef f(): var = 2\nprint var\n'
+        code = 'var = 1\ndef f(): var = 2\nprint(var)\n'
         pymod = self.pycore.get_string_module(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(pymod)
         pyname = name_finder.get_pyname_at(code.rindex('var'))
         self.assertEquals(pymod['var'], pyname)
 
     def test_one_liners_with_line_breaks(self):
-        code = 'var = 1\ndef f(\n): var = 2\nprint var\n'
+        code = 'var = 1\ndef f(\n): var = 2\nprint(var)\n'
         pymod = self.pycore.get_string_module(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(pymod)
         pyname = name_finder.get_pyname_at(code.rindex('var'))
         self.assertEquals(pymod['var'], pyname)
 
     def test_one_liners_with_line_breaks2(self):
-        code = 'var = 1\ndef f(\np): var = 2\nprint var\n'
+        code = 'var = 1\ndef f(\np): var = 2\nprint(var)\n'
         pymod = self.pycore.get_string_module(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(pymod)
         pyname = name_finder.get_pyname_at(code.rindex('var'))
         self.assertEquals((1, 3), line_finder.logical_line_in(2))
 
     def test_explicit_continuation(self):
-        code = 'print 2\na_var = (3 + \n    4, \n    5)\n'
+        code = 'print(2)\na_var = (3 + \n    4, \n    5)\n'
         line_finder = self._logical_finder(code)
         self.assertEquals((2, 4), line_finder.logical_line_in(2))
 
         self.assertEquals((1, 2), line_finder.logical_line_in(2))
 
     def test_fors_and_block_start(self):
-        code = 'l = range(10)\nfor i in l:\n    print i\n'
+        code = 'l = range(10)\nfor i in l:\n    print(i)\n'
         self.assertEquals(2, get_block_start(SourceLinesAdapter(code), 2))
 
     def test_problems_with_inner_indentations(self):