Source

rope_py3k / ropetest / refactor / change_signature_test.py

Diff from to

File ropetest/refactor/change_signature_test.py

         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals(code, self.mod.read())
+        self.assertEqual(code, self.mod.read())
 
     def test_normalizing_parameters_for_trivial_case2(self):
         code = 'def a_func(param):\n    pass\na_func(2)'
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals(code, self.mod.read())
+        self.assertEqual(code, self.mod.read())
 
     def test_normalizing_parameters_for_unneeded_keyword(self):
         self.mod.write('def a_func(param):\n    pass\na_func(param=1)')
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(param):\n    pass\na_func(1)', self.mod.read())
+        self.assertEqual('def a_func(param):\n    pass\na_func(1)', self.mod.read())
 
     def test_normalizing_parameters_for_unneeded_keyword_for_methods(self):
         code = 'class A(object):\n' \
                    '        pass\n' \
                    'a_var = A()\n' \
                    'a_var.a_func(1)\n'
-        self.assertEquals(expected, self.mod.read())
+        self.assertEqual(expected, self.mod.read())
 
     def test_normalizing_parameters_for_unsorted_keyword(self):
         self.mod.write('def a_func(p1, p2):\n    pass\na_func(p2=2, p1=1)')
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(p1, p2):\n    pass\na_func(1, 2)',
+        self.assertEqual('def a_func(p1, p2):\n    pass\na_func(1, 2)',
                           self.mod.read())
 
     @testutils.assert_raises(rope.base.exceptions.RefactoringError)
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(*arg):\n    pass\na_func(1, 2)\n',
+        self.assertEqual('def a_func(*arg):\n    pass\na_func(1, 2)\n',
                           self.mod.read())
 
     def test_normalizing_parameters_for_args_parameter_and_keywords(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(param, *args):\n    pass\n'
+        self.assertEqual('def a_func(param, *args):\n    pass\n'
                           'a_func(*[1, 2, 3])\n', self.mod.read())
 
     def test_normalizing_functions_from_other_modules(self):
         signature = ChangeSignature(self.project, mod1,
                                     mod1.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('import mod1\nmod1.a_func(1)\n', self.mod.read())
+        self.assertEqual('import mod1\nmod1.a_func(1)\n', self.mod.read())
 
     def test_normalizing_parameters_for_keyword_parameters(self):
         self.mod.write('def a_func(p1, **kwds):\n    pass\n'
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(p1, **kwds):\n    pass\n'
+        self.assertEqual('def a_func(p1, **kwds):\n    pass\n'
                           'a_func(1, p2=2)\n', self.mod.read())
 
     def test_removing_arguments(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(0)]))
-        self.assertEquals('def a_func():\n    pass\na_func()\n',
+        self.assertEqual('def a_func():\n    pass\na_func()\n',
                           self.mod.read())
 
     def test_removing_arguments_with_multiple_args(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(0)]))
-        self.assertEquals('def a_func(p2):\n    pass\na_func(2)\n',
+        self.assertEqual('def a_func(p2):\n    pass\na_func(2)\n',
                           self.mod.read())
 
     def test_removing_arguments_passed_as_keywords(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(0)]))
-        self.assertEquals('def a_func():\n    pass\na_func()\n',
+        self.assertEqual('def a_func():\n    pass\na_func()\n',
                           self.mod.read())
 
     def test_removing_arguments_with_defaults(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(0)]))
-        self.assertEquals('def a_func():\n    pass\na_func()\n',
+        self.assertEqual('def a_func():\n    pass\na_func()\n',
                           self.mod.read())
 
     def test_removing_arguments_star_args(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(1)]))
-        self.assertEquals('def a_func(p1):\n    pass\na_func(1)\n',
+        self.assertEqual('def a_func(p1):\n    pass\na_func(1)\n',
                           self.mod.read())
 
     def test_removing_keyword_arg(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(1)]))
-        self.assertEquals('def a_func(p1):\n    pass\na_func(1)\n',
+        self.assertEqual('def a_func(p1):\n    pass\na_func(1)\n',
                           self.mod.read())
 
     def test_removing_keyword_arg2(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(2)]))
-        self.assertEquals('def a_func(p1, *args):\n    pass\na_func(1)\n',
+        self.assertEqual('def a_func(p1, *args):\n    pass\na_func(1)\n',
                           self.mod.read())
 
     # XXX: What to do here for star args?
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(1)]))
-        self.assertEquals('def a_func(p1):\n    pass\na_func(p1=1)\n',
+        self.assertEqual('def a_func(p1):\n    pass\na_func(p1=1)\n',
                           self.mod.read())
 
     # XXX: What to do here for star args?
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(1)]))
-        self.assertEquals('def a_func(p1):\n    pass\na_func(*[1, 2, 3])\n',
+        self.assertEqual('def a_func(p1):\n    pass\na_func(*[1, 2, 3])\n',
                           self.mod.read())
 
     def test_adding_arguments_for_normal_args_changing_definition(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentAdder(0, 'p1')]))
-        self.assertEquals('def a_func(p1):\n    pass\n', self.mod.read())
+        self.assertEqual('def a_func(p1):\n    pass\n', self.mod.read())
 
     def test_adding_arguments_for_normal_args_with_defaults(self):
         self.mod.write('def a_func():\n    pass\na_func()\n')
                                     self.mod.read().index('a_func') + 1)
         adder = ArgumentAdder(0, 'p1', 'None')
         self.project.do(signature.get_changes([adder]))
-        self.assertEquals('def a_func(p1=None):\n    pass\na_func()\n',
+        self.assertEqual('def a_func(p1=None):\n    pass\na_func()\n',
                           self.mod.read())
 
     def test_adding_arguments_for_normal_args_changing_calls(self):
                                     self.mod.read().index('a_func') + 1)
         adder = ArgumentAdder(0, 'p1', 'None', '1')
         self.project.do(signature.get_changes([adder]))
-        self.assertEquals('def a_func(p1=None):\n    pass\na_func(1)\n',
+        self.assertEqual('def a_func(p1=None):\n    pass\na_func(1)\n',
                           self.mod.read())
 
     def test_adding_arguments_for_normal_args_changing_calls_with_keywords(self):
                                     self.mod.read().index('a_func') + 1)
         adder = ArgumentAdder(1, 'p2', '0', '1')
         self.project.do(signature.get_changes([adder]))
-        self.assertEquals('def a_func(p1=0, p2=0):\n    pass\na_func(p2=1)\n',
+        self.assertEqual('def a_func(p1=0, p2=0):\n    pass\na_func(p2=1)\n',
                           self.mod.read())
 
     def test_adding_arguments_for_normal_args_changing_calls_with_no_value(self):
                                     self.mod.read().index('a_func') + 1)
         adder = ArgumentAdder(0, 'p1', '0', None)
         self.project.do(signature.get_changes([adder]))
-        self.assertEquals('def a_func(p1=0, p2=0):\n    pass\na_func(p2=1)\n',
+        self.assertEqual('def a_func(p1=0, p2=0):\n    pass\na_func(p2=1)\n',
                           self.mod.read())
 
     @testutils.assert_raises(rope.base.exceptions.RefactoringError)
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentDefaultInliner(0)]))
-        self.assertEquals('def a_func(p1=0):\n    pass\n'
+        self.assertEqual('def a_func(p1=0):\n    pass\n'
                           'a_func(0)\n', self.mod.read())
 
     def test_inlining_default_arguments2(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentDefaultInliner(0)]))
-        self.assertEquals('def a_func(p1=0):\n    pass\n'
+        self.assertEqual('def a_func(p1=0):\n    pass\n'
                           'a_func(1)\n', self.mod.read())
 
     def test_preserving_args_and_keywords_order(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentNormalizer()]))
-        self.assertEquals('def a_func(*args, **kwds):\n    pass\n'
+        self.assertEqual('def a_func(*args, **kwds):\n    pass\n'
                           'a_func(3, 1, 2, a=1, c=3, b=2)\n', self.mod.read())
 
     def test_change_order_for_only_one_parameter(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentReorderer([0])]))
-        self.assertEquals('def a_func(p1):\n    pass\na_func(1)\n',
+        self.assertEqual('def a_func(p1):\n    pass\na_func(1)\n',
                           self.mod.read())
 
     def test_change_order_for_two_parameter(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentReorderer([1, 0])]))
-        self.assertEquals('def a_func(p2, p1):\n    pass\na_func(2, 1)\n',
+        self.assertEqual('def a_func(p2, p1):\n    pass\na_func(2, 1)\n',
                           self.mod.read())
 
     def test_reordering_multi_line_function_headers(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentReorderer([1, 0])]))
-        self.assertEquals('def a_func(p2, p1):\n    pass\na_func(2, 1)\n',
+        self.assertEqual('def a_func(p2, p1):\n    pass\na_func(2, 1)\n',
                           self.mod.read())
 
     def test_changing_order_with_static_params(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentReorderer([0, 2, 1])]))
-        self.assertEquals('def a_func(p1, p3=0, p2=0):\n    pass\n'
+        self.assertEqual('def a_func(p1, p3=0, p2=0):\n    pass\n'
                           'a_func(1, p2=2)\n', self.mod.read())
 
     def test_doing_multiple_changes(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         signature.get_changes(changers).do()
-        self.assertEquals('def a_func(p2):\n    pass\na_func()\n',
+        self.assertEqual('def a_func(p2):\n    pass\na_func()\n',
                           self.mod.read())
 
     def test_doing_multiple_changes2(self):
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         signature.get_changes(changers).do()
-        self.assertEquals('def a_func(p2, p3):\n    pass\na_func(2, 3)\n',
+        self.assertEqual('def a_func(p2, p3):\n    pass\na_func(2, 3)\n',
                           self.mod.read())
 
     def test_changing_signature_in_subclasses(self):
                                     self.mod.read().index('a_method') + 1)
         signature.get_changes([change_signature.ArgumentAdder(1, 'p1')],
                                  in_hierarchy=True).do()
-        self.assertEquals(
+        self.assertEqual(
             'class A(object):\n    def a_method(self, p1):\n        pass\n'
             'class B(A):\n    def a_method(self, p1):\n        pass\n',
             self.mod.read())
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('a_func') + 1)
         self.project.do(signature.get_changes([ArgumentRemover(1)]))
-        self.assertEquals(
+        self.assertEqual(
             'class A(object):\n    def a_func(self):\n        pass\n'
             'a_var = A()\nA.a_func(a_var)', self.mod.read())
 
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('C') + 1)
         signature.get_changes([change_signature.ArgumentRemover(1)]).do()
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n    def __init__(self):\n        pass\n'
             'c = C()\n',
             self.mod.read())
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('__init__') + 1)
         signature.get_changes([change_signature.ArgumentRemover(1)]).do()
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n    def __init__(self):\n        pass\n'
             'c = C()\n',
             self.mod.read())
         signature = ChangeSignature(self.project, self.mod,
                                     self.mod.read().index('__init__') + 1)
         signature.get_changes([change_signature.ArgumentRemover(1)]).do()
-        self.assertEquals(
+        self.assertEqual(
             'class A(object):\n    def __init__(self):\n        pass\n'
             'class B(A):\n    '
             'def __init__(self, p):\n        super(B, self).__init__()\n',
                                     self.mod.read().rindex('f'))
         signature.get_changes(
             [change_signature.ArgumentReorderer([1, 2, 0])]).do()
-        self.assertEquals('def f(b, c, a):\n    pass\nf(2, 3, 1)\n',
+        self.assertEqual('def f(b, c, a):\n    pass\nf(2, 3, 1)\n',
                           self.mod.read())
 
     def test_resources_parameter(self):
                                     mod1.read().index('a_func') + 1)
         signature.get_changes([change_signature.ArgumentRemover(0)],
                               resources=[mod1]).do()
-        self.assertEquals('import mod1\nmod1.a_func(1)\n', self.mod.read())
-        self.assertEquals('def a_func():\n    pass\n', mod1.read())
+        self.assertEqual('import mod1\nmod1.a_func(1)\n', self.mod.read())
+        self.assertEqual('def a_func():\n    pass\n', mod1.read())
 
     def test_reordering_and_automatic_defaults(self):
         code = 'def f(p1, p2=2):\n' \
         expected = 'def f(p2=2, p1=1):\n' \
                    '    pass\n' \
                    'f(2, 1)\n'
-        self.assertEquals(expected, self.mod.read())
+        self.assertEqual(expected, self.mod.read())
 
 
 if __name__ == '__main__':