Commits

Anonymous committed 785ed7b

Changed movetest and inlinetest to use print(...) instead of print ...

  • Participants
  • Parent commits fb2406d

Comments (0)

Files changed (8)

File docs/dev/issues.txt

 candidates before the ``x.y``.
 
 
-Version 0.6
+Version 0.7
 ===========
 
-From May 7, 2007 till August 5, 2007
+From August 6, 2007 till October 28, 2007
 
 
 Release Goals
 -------------
 
-Metaphor: Supporting restructurings
-
-Other Possible Goals:
-
-* Finding similar pieces to extracted
+* Getting ready for Python 3.0
 
 
 Release Issues
 --------------
 
-Rope has dropped Python 2.4 support in this release.
 
 
 Hot Topics
   control or none.
 * All ``*.txt`` files are considered to be ReST.
 * XXX
-
-
-Object Inference Issues
-=======================
-
-
-Returned Types Or Objects
--------------------------
-
-Should we care only about the type of the returned object or we should
-consider the object itself, too?
-
-Well, it depends on the type of the objects that is returned.  If it
-is an instance of a class then only the type matters.  If it is a
-function, module or class then the object is important.
-
-Indeed we should make some difference between the objects that we
-only care about their types and the objects that their individual
-instance is important to us.  Right now the latter group contains
-only functions, classes, modules, lists, dicts and sets but this
-list will be probably extended.
-
-
-The GUI Mess; Working More on the UI Parts
-==========================================
-
-
-Version Control Commands
-------------------------
-
-* Commit; ``C-x v c``
-* Update; ``C-x v u``
-* Diff; ``C-x v d``
-* Log; ``C-x v l``
-* Revert; ``C-x v r``
-* Remove; ``C-x v v``
-* Status; ``C-x v s``
-* Add; ``C-x v a``
-* Blame; ``C-x v b``
-
-
-Better Dialogs
---------------
-
-Many dialogs look very similar.  They can be factored.  Continue using
-`rope.ui.uihelpers` module and extend it.
-
-
-Isolating Text Widget Features
-------------------------------
-
-Some of the features of GraphicalEditor can be used in other widgets.
-Like completion, highlighting.
-
-
-Defining the Responsibilities of `Core`
----------------------------------------
-
-* Providing an interface to the plug-ins
-* Providing methods for controlling rope?

File docs/dev/stories.txt

 
 
 * Sorting methods
+
+
+> Public Release 0.7m1 : August 19, 2007

File docs/dev/workingon.txt

 Small Stories
 =============
 
+* Renaming `rope.py` to `ropeide.py`?
 * Changing the default font on linux to courier?
 
 * Lots of exceptions for `PyFunction`
 #! /usr/bin/python
 import rope.ui.core
 
+
 if __name__ == '__main__':
     rope.ui.core.Core.get_core().run()
-

File rope/__init__.py

 """rope, a python refactoring library"""
 
 INFO = __doc__
-VERSION = '0.6'
+VERSION = '0.7m1'
 COPYRIGHT = """\
 Copyright (C) 2006-2007 Ali Gholami Rudi
 

File rope/ui/refactor.py

             'occurrences with `goal`.  They can contain ``${?name}`` and \n' \
             '``${name}`` wildcards.  See ``docs/overview.txt`` for examples.'
         goals_help = \
-            'Pieces of code that that match the pattern will be replaced\n' \
+            'Pieces of code that match the pattern will be replaced\n' \
             'with goal.  It can contain the wildcards that appear in the\n' \
             'pattern; They are replaced with the code that has matched them.'
         tkhelpers.ToolTip(self.pattern, patterns_help)
         # Handling checks
         checks_frame = Tkinter.Frame(frame, borderwidth=1,
                                      relief=Tkinter.RIDGE)
-        checks_help = 'Add checks here; One each line.  For instance:\n' \
-                      '?var.type == mymod.AClass'
+        checks_help = 'Add checks here; One each line.  Like:\n' \
+                      '  ?var.type == mymod.AClass\n' \
+                      '\nUse __builtin__ module for builtins'
         checks_label = Tkinter.Label(checks_frame, text='Checks',
                                      justify=Tkinter.LEFT, width=70)
         checks_label.grid(row=0)
         imports_frame = Tkinter.Frame(frame, borderwidth=1,
                                       relief=Tkinter.RIDGE)
         imports_help = 'Add imports here; These imports are added to ' \
-                       'changed files'
+                       'changed files; Like:\n  from mymod import AClass'
         imports_label = Tkinter.Label(imports_frame, text='Imports',
                                       justify=Tkinter.LEFT, width=70)
         imports_label.grid(row=0)

File ropetest/refactor/inlinetest.py

         self.assertEquals('', self.mod.read())
 
     def test_a_function_with_no_occurance2(self):
-        self.mod.write('a_var = 10\ndef a_func():\n    pass\nprint a_var\n')
+        self.mod.write('a_var = 10\ndef a_func():\n    pass\nprint(a_var)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('a_var = 10\nprint a_var\n', self.mod.read())
+        self.assertEquals('a_var = 10\nprint(a_var)\n', self.mod.read())
 
     def test_replacing_calls_with_function_definition_in_other_modules(self):
-        self.mod.write('def a_func():\n    print 1\n')
+        self.mod.write('def a_func():\n    print(1)\n')
         mod1 = self.pycore.create_module(self.project.root, 'mod1')
         mod1.write('import mod\nmod.a_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('import mod\nprint 1\n', mod1.read())
+        self.assertEquals('import mod\nprint(1)\n', mod1.read())
 
     def test_replacing_calls_with_function_definition_in_other_modules2(self):
-        self.mod.write('def a_func():\n    print 1\n')
+        self.mod.write('def a_func():\n    print(1)\n')
         mod1 = self.pycore.create_module(self.project.root, 'mod1')
         mod1.write('import mod\nif True:\n    mod.a_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('import mod\nif True:\n    print 1\n', mod1.read())
+        self.assertEquals('import mod\nif True:\n    print(1)\n', mod1.read())
 
     def test_replacing_calls_with_method_definition_in_other_modules(self):
-        self.mod.write('class A(object):\n    var = 10\n    def a_func(self):\n        print 1\n')
+        self.mod.write('class A(object):\n    var = 10\n'
+                       '    def a_func(self):\n        print(1)\n')
         mod1 = self.pycore.create_module(self.project.root, 'mod1')
         mod1.write('import mod\nmod.A().a_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('import mod\nprint 1\n', mod1.read())
+        self.assertEquals('import mod\nprint(1)\n', mod1.read())
         self.assertEquals('class A(object):\n    var = 10\n', self.mod.read())
 
     def test_replacing_calls_with_function_definition_in_defining_module(self):
-        self.mod.write('def a_func():\n    print 1\na_func()\n')
+        self.mod.write('def a_func():\n    print(1)\na_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print 1\n', self.mod.read())
+        self.assertEquals('print(1)\n', self.mod.read())
 
     def test_replacing_calls_with_function_definition_in_defining_module2(self):
-        self.mod.write('def a_func():\n    for i in range(10):\n        print 1\na_func()\n')
+        self.mod.write('def a_func():\n    for i in range(10):\n        print(1)\na_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('for i in range(10):\n    print 1\n', self.mod.read())
+        self.assertEquals('for i in range(10):\n    print(1)\n', self.mod.read())
 
     def test_replacing_calls_with_method_definition_in_defining_modules(self):
         self.mod.write('class A(object):\n    var = 10\n'
-                       '    def a_func(self):\n        print 1\nA().a_func()')
+                       '    def a_func(self):\n        print(1)\nA().a_func()')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('class A(object):\n    var = 10\nprint 1\n', self.mod.read())
+        self.assertEquals('class A(object):\n    var = 10\nprint(1)\n', self.mod.read())
 
     def test_parameters_with_the_same_name_as_passed(self):
-        self.mod.write('def a_func(var):\n    print var\nvar = 1\na_func(var)\n')
+        self.mod.write('def a_func(var):\n    print(var)\nvar = 1\na_func(var)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('var = 1\nprint var\n', self.mod.read())
+        self.assertEquals('var = 1\nprint(var)\n', self.mod.read())
 
     def test_parameters_with_the_same_name_as_passed2(self):
-        self.mod.write('def a_func(var):\n    print var\nvar = 1\na_func(var=var)\n')
+        self.mod.write('def a_func(var):\n    print(var)\nvar = 1\na_func(var=var)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('var = 1\nprint var\n', self.mod.read())
+        self.assertEquals('var = 1\nprint(var)\n', self.mod.read())
 
     def test_simple_parameters_renaming(self):
-        self.mod.write('def a_func(param):\n    print param\nvar = 1\na_func(var)\n')
+        self.mod.write('def a_func(param):\n    print(param)\nvar = 1\na_func(var)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('var = 1\nprint var\n', self.mod.read())
+        self.assertEquals('var = 1\nprint(var)\n', self.mod.read())
 
     def test_simple_parameters_renaming_for_multiple_params(self):
         self.mod.write('def a_func(param1, param2):\n    p = param1 + param2\n'
         self.assertEquals('var1 = 1\nvar2 = 1\np = var1 + var2\n', self.mod.read())
 
     def test_parameters_renaming_for_passed_constants(self):
-        self.mod.write('def a_func(param):\n    print param\na_func(1)\n')
+        self.mod.write('def a_func(param):\n    print(param)\na_func(1)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print 1\n', self.mod.read())
+        self.assertEquals('print(1)\n', self.mod.read())
 
     def test_parameters_renaming_for_passed_statements(self):
-        self.mod.write('def a_func(param):\n    print param\na_func((1 + 2) / 3)\n')
+        self.mod.write('def a_func(param):\n    print(param)\na_func((1 + 2) / 3)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print (1 + 2) / 3\n', self.mod.read())
+        self.assertEquals('print((1 + 2) / 3)\n', self.mod.read())
 
     def test_simple_parameters_renaming_for_multiple_params_using_keywords(self):
         self.mod.write('def a_func(param1, param2):\n    p = param1 + param2\n'
         self.assertEquals('var1 = 1\nvar2 = 1\np = var2 + var1\n', self.mod.read())
 
     def test_simple_putting_in_default_arguments(self):
-        self.mod.write('def a_func(param=None):\n    print param\n'
+        self.mod.write('def a_func(param=None):\n    print(param)\n'
                        'a_func()\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print None\n', self.mod.read())
+        self.assertEquals('print(None)\n', self.mod.read())
 
     def test_overriding_default_arguments(self):
-        self.mod.write('def a_func(param1=1, param2=2):\n    print param1, param2\n'
+        self.mod.write('def a_func(param1=1, param2=2):\n    print(param1, param2)\n'
                        'a_func(param2=3)\n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print 1, 3\n', self.mod.read())
+        self.assertEquals('print(1, 3)\n', self.mod.read())
 
     def test_badly_formatted_text(self):
-        self.mod.write('def a_func  (  param1 =  1 ,param2 = 2 )  :\n    print param1, param2\n'
+        self.mod.write('def a_func  (  param1 =  1 ,param2 = 2 )  :\n    print(param1, param2)\n'
                        'a_func  ( param2 \n  = 3 )  \n')
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
-        self.assertEquals('print 1, 3\n', self.mod.read())
+        self.assertEquals('print(1, 3)\n', self.mod.read())
 
     def test_passing_first_arguments_for_methods(self):
         a_class = 'class A(object):\n' \
                   '        self.var = 1\n' \
                   '        self.a_func(self.var)\n' \
                   '    def a_func(self, param):\n' \
-                  '        print param\n'
+                  '        print(param)\n'
         self.mod.write(a_class)
         self._inline2(self.mod, self.mod.read().index('a_func') + 1)
         expected = 'class A(object):\n' \
                    '    def __init__(self):\n' \
                    '        self.var = 1\n' \
-                   '        print self.var\n'
+                   '        print(self.var)\n'
         self.assertEquals(expected, self.mod.read())
 
     def test_passing_first_arguments_for_methods2(self):
                   '    def __init__(self):\n' \
                   '        self.var = 1\n' \
                   '    def a_func(self, param):\n' \
-                  '        print param, self.var\n' \
+                  '        print(param, self.var)\n' \
                   'an_a = A()\n' \
                   'an_a.a_func(1)\n'
         self.mod.write(a_class)
                    '    def __init__(self):\n' \
                    '        self.var = 1\n' \
                    'an_a = A()\n' \
-                   'print 1, an_a.var\n'
+                   'print(1, an_a.var)\n'
         self.assertEquals(expected, self.mod.read())
 
     def test_passing_first_arguments_for_methods3(self):
                   '    def __init__(self):\n' \
                   '        self.var = 1\n' \
                   '    def a_func(self, param):\n' \
-                  '        print param, self.var\n' \
+                  '        print(param, self.var)\n' \
                   'an_a = A()\n' \
                   'A.a_func(an_a, 1)\n'
         self.mod.write(a_class)
                    '    def __init__(self):\n' \
                    '        self.var = 1\n' \
                    'an_a = A()\n' \
-                   'print 1, an_a.var\n'
+                   'print(1, an_a.var)\n'
         self.assertEquals(expected, self.mod.read())
 
     def test_inlining_staticmethods(self):

File ropetest/refactor/movetest.py

     def test_moving_used_imports_to_destination_module(self):
         self.mod3.write('a_var = 10')
         self.mod1.write('import mod3\nfrom mod3 import a_var\n' \
-                        'def a_func():\n    print mod3, a_var\n')
+                        'def a_func():\n    print(mod3, a_var)\n')
         self._move(self.mod1, self.mod1.read().index('a_func') + 1,
                    self.mod2)
         self.assertEquals('import mod3\n\n\n' \
-                          'def a_func():\n    print mod3, mod3.a_var\n',
+                          'def a_func():\n    print(mod3, mod3.a_var)\n',
                           self.mod2.read())
 
     def test_moving_used_names_to_destination_module2(self):
         self.mod1.write('a_var = 10\n' \
-                        'def a_func():\n    print a_var\n')
+                        'def a_func():\n    print(a_var)\n')
         self._move(self.mod1, self.mod1.read().index('a_func') + 1,
                    self.mod2)
         self.assertEquals('a_var = 10\n', self.mod1.read())
-        self.assertEquals('import mod1\n\n\ndef a_func():\n    print mod1.a_var\n',
+        self.assertEquals('import mod1\n\n\ndef a_func():\n    print(mod1.a_var)\n',
                           self.mod2.read())
 
     def test_moving_and_used_relative_imports(self):
         self.mod4.write('import mod5\n' \
-                        'def a_func():\n    print mod5\n')
+                        'def a_func():\n    print(mod5)\n')
         self._move(self.mod4, self.mod4.read().index('a_func') + 1,
                    self.mod1)
-        self.assertEquals('import pkg.mod5\n\n\ndef a_func():\n    print pkg.mod5\n',
+        self.assertEquals('import pkg.mod5\n\n\ndef a_func():\n    print(pkg.mod5)\n',
                           self.mod1.read())
 
     def test_moving_modules(self):
-        self.mod2.write('import mod1\nprint mod1')
+        self.mod2.write('import mod1\nprint(mod1)')
         self._move(self.mod2, self.mod2.read().index('mod1') + 1, self.pkg)
-        self.assertEquals('import pkg.mod1\nprint pkg.mod1', self.mod2.read())
+        self.assertEquals('import pkg.mod1\nprint(pkg.mod1)', self.mod2.read())
         self.assertTrue(not self.mod1.exists() and
                         self.pycore.find_module('pkg.mod1') is not None)
 
     def test_moving_modules_and_removing_out_of_date_imports(self):
-        self.mod2.write('import pkg.mod4\nprint pkg.mod4')
+        self.mod2.write('import pkg.mod4\nprint(pkg.mod4)')
         self._move(self.mod2, self.mod2.read().index('mod4') + 1,
                    self.project.root)
-        self.assertEquals('import mod4\nprint mod4', self.mod2.read())
+        self.assertEquals('import mod4\nprint(mod4)', self.mod2.read())
         self.assertTrue(self.pycore.find_module('mod4') is not None)
 
     def test_moving_modules_and_removing_out_of_date_froms(self):
-        self.mod2.write('from pkg import mod4\nprint mod4')
+        self.mod2.write('from pkg import mod4\nprint(mod4)')
         self._move(self.mod2, self.mod2.read().index('mod4') + 1,
                    self.project.root)
-        self.assertEquals('import mod4\nprint mod4', self.mod2.read())
+        self.assertEquals('import mod4\nprint(mod4)', self.mod2.read())
 
     def test_moving_modules_and_removing_out_of_date_froms2(self):
         self.mod4.write('a_var = 10')
-        self.mod2.write('from pkg.mod4 import a_var\nprint a_var\n')
+        self.mod2.write('from pkg.mod4 import a_var\nprint(a_var)\n')
         self._move(self.mod2, self.mod2.read().index('mod4') + 1,
                    self.project.root)
-        self.assertEquals('from mod4 import a_var\nprint a_var\n',
+        self.assertEquals('from mod4 import a_var\nprint(a_var)\n',
                           self.mod2.read())
 
     def test_moving_modules_and_relative_import(self):
-        self.mod4.write('import mod5\nprint mod5\n')
-        self.mod2.write('import pkg.mod4\nprint pkg.mod4')
+        self.mod4.write('import mod5\nprint(mod5)\n')
+        self.mod2.write('import pkg.mod4\nprint(pkg.mod4)')
         self._move(self.mod2, self.mod2.read().index('mod4') + 1,
                    self.project.root)
         moved = self.pycore.find_module('mod4')
-        self.assertEquals('import pkg.mod5\nprint pkg.mod5\n', moved.read())
+        self.assertEquals('import pkg.mod5\nprint(pkg.mod5)\n', moved.read())
 
     def test_moving_packages(self):
         pkg2 = self.pycore.create_package(self.project.root, 'pkg2')
-        self.mod1.write('import pkg.mod4\nprint pkg.mod4')
+        self.mod1.write('import pkg.mod4\nprint(pkg.mod4)')
         self._move(self.mod1, self.mod1.read().index('pkg') + 1, pkg2)
         self.assertFalse(self.pkg.exists())
         self.assertTrue(self.pycore.find_module('pkg2.pkg.mod4') is not None)
         self.assertTrue(self.pycore.find_module('pkg2.pkg.mod4') is not None)
         self.assertTrue(self.pycore.find_module('pkg2.pkg.mod5') is not None)
-        self.assertEquals('import pkg2.pkg.mod4\nprint pkg2.pkg.mod4', self.mod1.read())
+        self.assertEquals('import pkg2.pkg.mod4\nprint(pkg2.pkg.mod4)',
+                          self.mod1.read())
 
     def test_moving_modules_with_self_imports(self):
-        self.mod1.write('import mod1\nprint mod1\n')
+        self.mod1.write('import mod1\nprint(mod1)\n')
         self.mod2.write('import mod1\n')
         self._move(self.mod2, self.mod2.read().index('mod1') + 1, self.pkg)
         moved = self.pycore.find_module('pkg.mod1')
-        self.assertEquals('import pkg.mod1\nprint pkg.mod1\n', moved.read())
+        self.assertEquals('import pkg.mod1\nprint(pkg.mod1)\n', moved.read())
 
     def test_moving_funtions_to_imported_module(self):
         self.mod1.write('a_var = 1\n')
     def test_moving_module_refactoring_and_not_removing_blanks_after_imports(self):
         self.mod4.write('a_var = 1')
         self.mod2.write('from pkg import mod4\n'
-                        'import os\n\n\nprint mod4.a_var\n')
+                        'import os\n\n\nprint(mod4.a_var)\n')
         mover = move.create_move(self.project, self.mod4)
         mover.get_changes(self.project.root).do()
         self.assertEquals('import os\nimport mod4\n\n\n'
-                          'print mod4.a_var\n', self.mod2.read())
+                          'print(mod4.a_var)\n', self.mod2.read())
 
     @testutils.assert_raises(exceptions.RefactoringError)
     def test_moving_module_refactoring_and_nonexistent_destinations(self):
         self.mod4.write('a_var = 1')
         self.mod2.write('from pkg import mod4\n'
-                        'import os\n\n\nprint mod4.a_var\n')
+                        'import os\n\n\nprint(mod4.a_var)\n')
         mover = move.create_move(self.project, self.mod4)
         mover.get_changes(None).do()