zjes avatar zjes committed 6e28c44

Add new try node, fix deprecated messages in tests

Comments (0)

Files changed (28)

rope/refactor/patchedast.py

 import collections
 import re
 import warnings
+import sys
 
 from rope.base import ast, codeanalyze, exceptions
 
             children.extend(['else', ':'])
             children.extend(node.orelse)
         self._handle(node, children)
+        
+    def _Try(self, node):
+        children = ['try', ':']
+        children.extend(node.body)
+        children.extend(node.handlers)
+        if node.orelse:
+            children.extend(['else', ':'])
+            children.extend(node.orelse)
+        if node.finalbody:
+            children.extend(['finally', ':'])
+            children.extend(node.finalbody)
+            
+        self._handle(node, children)
 
     def _ExceptHandler(self, node):
         self._excepthandler(node)
         self._handle(node, children)
 
     def _With(self, node):
-        children = ['with', node.context_expr]
-        if node.optional_vars:
-            children.extend(['as', node.optional_vars])
+        children = []
+        if (sys.version_info[1] < 3):
+            children = ['with', node.context_expr]
+            if node.optional_vars:
+                children.extend(['as', node.optional_vars])
+        else:
+            children = ['with', node.items[0].context_expr]
+            if node.items[0].optional_vars:
+                children.extend(['as', node.items[0].optional_vars])
         children.append(':')
         children.extend(node.body)
         self._handle(node, children)

rope/refactor/suites.py

         if node.orelse:
             self.suites.append(Suite(node.orelse, node.lineno, self.suite))
 
+    def _Try(self, node):
+        self.suites.append(Suite(node.body, node.lineno, self.suite))
+        for handler in node.handlers:
+            self.suites.append(Suite(handler.body, node.lineno, self.suite))
+        if node.orelse:
+            self.suites.append(Suite(node.orelse, node.lineno, self.suite))
+        if node.finalbody:
+            self.suites.append(Suite(node.finalbody, node.lineno, self.suite))
+
     def _add_if_like_node(self, node):
         self.suites.append(Suite(node.body, node.lineno, self.suite))
         if node.orelse:

ropetest/advanced_oi_test.py

         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod['a_func'].get_object(),
+        self.assertEqual(pymod['a_func'].get_object(),
                           pymod['a_var'].get_object())
 
     def test_module_dti(self):
         mod2.write(code)
         self.pycore.run_module(mod2).wait_process()
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        self.assertEquals(self.pycore.resource_to_pyobject(mod1),
+        self.assertEqual(self.pycore.resource_to_pyobject(mod1),
                           pymod2['a_var'].get_object())
 
     def test_class_from_another_module_dti(self):
         self.pycore.run_module(mod2).wait_process()
         pymod1 = self.pycore.resource_to_pyobject(mod1)
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        self.assertEquals(pymod2['AClass'].get_object(),
+        self.assertEqual(pymod2['AClass'].get_object(),
                           pymod2['a_var'].get_object())
 
 
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod['AClass'].get_object(),
+        self.assertEqual(pymod['AClass'].get_object(),
                           pymod['a_var'].get_object())
 
     def test_instance_dti(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod['AClass'].get_object(),
+        self.assertEqual(pymod['AClass'].get_object(),
                           pymod['a_var'].get_object().get_type())
 
     def test_method_dti(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod['AClass'].get_object(),
+        self.assertEqual(pymod['AClass'].get_object(),
                           pymod['a_var'].get_object().get_type())
 
     def test_function_argument_dti(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pyscope = self.pycore.resource_to_pyobject(mod).get_scope()
-        self.assertEquals(pyscope['a_func'].get_object(),
+        self.assertEqual(pyscope['a_func'].get_object(),
                           pyscope.get_scopes()[0]['arg'].get_object())
 
     def test_classes_with_the_same_name(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertEquals(pymod['AClass'].get_object(),
+        self.assertEqual(pymod['AClass'].get_object(),
                           pymod['a_var'].get_object())
 
     def test_nested_classes(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pyscope = self.pycore.resource_to_pyobject(mod).get_scope()
-        self.assertEquals(pyscope.get_scopes()[0]['AClass'].get_object(),
+        self.assertEqual(pyscope.get_scopes()[0]['AClass'].get_object(),
                           pyscope['a_var'].get_object())
 
     def test_function_argument_dti2(self):
         mod.write(code)
         self.pycore.run_module(mod).wait_process()
         pyscope = self.pycore.resource_to_pyobject(mod).get_scope()
-        self.assertEquals(pyscope['a_func'].get_object(),
+        self.assertEqual(pyscope['a_func'].get_object(),
                           pyscope.get_scopes()[0]['arg'].get_object())
 
     def test_dti_and_concluded_data_invalidation(self):
         pymod = self.pycore.resource_to_pyobject(mod)
         pymod['a_var'].get_object()
         self.pycore.run_module(mod).wait_process()
-        self.assertEquals(pymod['a_func'].get_object(),
+        self.assertEqual(pymod['a_func'].get_object(),
                           pymod['a_var'].get_object())
 
     def test_list_objects_and_dynamicoi(self):
         pymod = self.pycore.resource_to_pyobject(mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_for_loops_and_dynamicoi(self):
         mod = testutils.create_module(self.project, 'mod')
         pymod = self.pycore.resource_to_pyobject(mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_dict_objects_and_dynamicoi(self):
         mod = testutils.create_module(self.project, 'mod')
         pymod = self.pycore.resource_to_pyobject(mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_dict_keys_and_dynamicoi(self):
         mod = testutils.create_module(self.project, 'mod')
         pymod = self.pycore.resource_to_pyobject(mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_dict_keys_and_dynamicoi2(self):
         mod = testutils.create_module(self.project, 'mod')
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_strs_and_dynamicoi(self):
         mod = testutils.create_module(self.project, 'mod')
                 to_pyobject.transform(to_textual.transform(pyobject)))
         for name in ('C', 'f', 'a_var', 'a_list', 'a_str', 'a_file'):
             var = pymod[name].get_object()
-            self.assertEquals(to_textual.transform(var), complex_to_textual(var))
-        self.assertEquals(to_textual.transform(pymod), complex_to_textual(pymod))
+            self.assertEqual(to_textual.transform(var), complex_to_textual(var))
+        self.assertEqual(to_textual.transform(pymod), complex_to_textual(pymod))
         enumerate_func = rope.base.builtins.builtins['enumerate'].get_object()
-        self.assertEquals(to_textual.transform(enumerate_func),
+        self.assertEqual(to_textual.transform(enumerate_func),
                           complex_to_textual(enumerate_func))
 
     def test_arguments_with_keywords(self):
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_a_function_with_different_returns(self):
         mod = testutils.create_module(self.project, 'mod')
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_a_function_with_different_returns2(self):
         mod = testutils.create_module(self.project, 'mod')
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_ignoring_star_args(self):
         mod = testutils.create_module(self.project, 'mod')
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_ignoring_double_star_args(self):
         mod = testutils.create_module(self.project, 'mod')
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_invalidating_data_after_changing(self):
         mod = testutils.create_module(self.project, 'mod')
         mod.write(code.replace('a_func', 'newfunc'))
         mod.write(code)
         pymod = self.pycore.resource_to_pyobject(mod)
-        self.assertNotEquals(pymod['a_func'].get_object(),
+        self.assertNotEqual(pymod['a_func'].get_object(),
                              pymod['a_var'].get_object())
 
     def test_invalidating_data_after_moving(self):
         mod.move('newmod.py')
         pymod = self.pycore.get_module('newmod')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
-        self.assertEquals(pymod2['C'].get_object(),
+        self.assertEqual(pymod2['C'].get_object(),
                           pymod['a_var'].get_object())
 
 
         c_class = pymod['C'].get_object()
         f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(c_class, p_type)
+        self.assertEqual(c_class, p_type)
 
     def test_static_oi_not_failing_when_callin_callables(self):
         code = 'class C(object):\n    pass\nC()\n'
         c_class = pymod['C'].get_object()
         f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(c_class, p_type)
+        self.assertEqual(c_class, p_type)
 
     def test_static_oi_class_methods(self):
         code = 'class C(object):\n    def f(self, p):\n        pass\n' \
         c_class = pymod['C'].get_object()
         f_scope = c_class['f'].get_object().get_scope()
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(c_class, p_type)
+        self.assertEqual(c_class, p_type)
 
     def test_static_oi_preventing_soi_maximum_recursion_exceptions(self):
         code = 'item = {}\nfor item in item.keys():\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_a_function_with_different_returns(self):
         code = 'class C1(object):\n    pass\nclass C2(object):\n    pass\n' \
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_not_reporting_out_of_date_information(self):
         code = 'class C1(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c1_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
 
         self.mod.write(code.replace('C1', 'C2'))
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c2_class, a_var.get_type())
+        self.assertEqual(c2_class, a_var.get_type())
 
     def test_invalidating_concluded_data_in_a_function(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
         c1_class = pymod2['C1'].get_object()
         a_var = pymod2['a_var'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
 
         mod2.write(mod2.read()[:mod2.read().rfind('C1()')] + 'C2())\n')
         pymod2 = self.pycore.resource_to_pyobject(mod2)
         c2_class = pymod2['C2'].get_object()
         a_var = pymod2['a_var'].get_object()
-        self.assertEquals(c2_class, a_var.get_type())
+        self.assertEqual(c2_class, a_var.get_type())
 
     def test_handling_generator_functions_for_strs(self):
         self.mod.write('class C(object):\n    pass\ndef f(p):\n    yield p()\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     # TODO: Returning a generator for functions that yield unknowns
     def xxx_test_handling_generator_functions_when_unknown_type_is_yielded(self):
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_get_item(self):
         code = 'class C(object):\n    pass\nl = list()\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_fields(self):
         code = 'class C(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_set_item(self):
         code = 'class C(object):\n    pass\nl = [None]\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_extending_lists(self):
         code = 'class C(object):\n    pass\nl = []\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_lists_per_object_for_iters(self):
         code = 'class C(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_static_oi_for_dicts_depending_on_append_function(self):
         code = 'class C1(object):\n    pass\nclass C2(object):\n    pass\n' \
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_static_oi_for_dicts_depending_on_for_loops(self):
         code = 'class C1(object):\n    pass\nclass C2(object):\n    pass\n' \
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_static_oi_for_dicts_depending_on_update(self):
         code = 'class C1(object):\n    pass\nclass C2(object):\n    pass\n' \
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_static_oi_for_dicts_depending_on_update_on_seqs(self):
         code = 'class C1(object):\n    pass\nclass C2(object):\n    pass\n' \
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_static_oi_for_sets_per_object_for_set_item(self):
         code = 'class C(object):\n    pass\ns = set()\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_properties_and_calling_get_property(self):
         code = 'class C1(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c1_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
 
     def test_soi_on_constructors(self):
         code = 'class C1(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c1_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
 
     def test_not_saving_unknown_function_returns(self):
         mod2 = testutils.create_module(self.project, 'mod2')
         a_var = pymod2['a_var']
 
         self.pycore.analyze_module(mod2)
-        self.assertNotEquals(c_class, a_var.get_object().get_type())
+        self.assertNotEqual(c_class, a_var.get_object().get_type())
 
         self.pycore.analyze_module(self.mod)
-        self.assertEquals(c_class, a_var.get_object().get_type())
+        self.assertEqual(c_class, a_var.get_object().get_type())
 
     def test_using_the_best_callinfo(self):
         code = 'class C1(object):\n    pass\n' \
         c1_class = pymod['C1'].get_object()
         f_scope = pymod['f'].get_object().get_scope()
         arg2 = f_scope['arg2'].get_object()
-        self.assertEquals(c1_class, arg2.get_type())
+        self.assertEqual(c1_class, arg2.get_type())
 
     def test_call_function_and_parameters(self):
         code = 'class A(object):\n    def __call__(self, p):\n        pass\n' \
         c_class = pymod['C'].get_object()
         f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(c_class, p_type)
+        self.assertEqual(c_class, p_type)
 
     def test_report_libutils_and_analyze_all_modules(self):
         code = 'class C(object):\n    pass\ndef f(p):\n    pass\nf(C())\n'
         c_class = pymod['C'].get_object()
         f_scope = pymod['f'].get_object().get_scope()
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(c_class, p_type)
+        self.assertEqual(c_class, p_type)
 
     def test_validation_problems_for_objectdb_retrievals(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         c_class = pymod2['C'].get_object()
         pymod1 = self.pycore.resource_to_pyobject(mod1)
         var_pyname = pymod1['var']
-        self.assertEquals(c_class, var_pyname.get_object().get_type())
+        self.assertEqual(c_class, var_pyname.get_object().get_type())
         mod2.write('import mod1\n\nmod1.l.append("")\n')
-        self.assertNotEquals(c_class, var_pyname.get_object().get_type(),
+        self.assertNotEqual(c_class, var_pyname.get_object().get_type(),
                              'Class `C` no more exists')
 
     def test_validation_problems_for_changing_builtin_types(self):
         a_class = pymod['A'].get_object()
         f_scope = a_class.get_scope().get_scopes()[0]
         p_type = f_scope['p'].get_object().get_type()
-        self.assertEquals(a_class, p_type)
+        self.assertEqual(a_class, p_type)
 
     def test_following_function_calls_when_asked_to(self):
         code = 'class A(object):\n    pass\n' \
         pymod = self.pycore.resource_to_pyobject(self.mod)
         a_class = pymod['A'].get_object()
         x_var = pymod['x'].get_object().get_type()
-        self.assertEquals(a_class, x_var)
+        self.assertEqual(a_class, x_var)
 
 
 def suite():

ropetest/builtinstest.py

         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_get_items(self):
         self.mod.write('class C(object):\n    def __getitem__(self, i):\n        return C()\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_get_items_for_lists(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\na_var = l[0]\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_get_items_from_slices(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\na_var = l[:].pop()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_simple_for_loops(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_definition_location_for_loop_variables(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
                        'for c in l:\n    pass\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_var = pymod['c']
-        self.assertEquals((pymod, 4), c_var.get_definition_location())
+        self.assertEqual((pymod, 4), c_var.get_definition_location())
 
     def test_simple_case_for_dicts(self):
         self.mod.write('d = {}\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_popping_dicts(self):
         self.mod.write('class C(object):\n    pass\nd = {1: C()}\na_var = d.pop(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_getting_keys_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_getting_values_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C2'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_getting_iterkeys_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_getting_itervalues_from_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C2'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_using_copy_for_dicts(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C1'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_tuple_assignments_for_items(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         c2_class = pymod['C2'].get_object()
         key = pymod['key'].get_object()
         value = pymod['value'].get_object()
-        self.assertEquals(c1_class, key.get_type())
-        self.assertEquals(c2_class, value.get_type())
+        self.assertEqual(c1_class, key.get_type())
+        self.assertEqual(c2_class, value.get_type())
 
     def test_tuple_assignment_for_lists(self):
         self.mod.write('class C(object):\n    pass\nl = [C(), C()]\na, b = l\n')
         c_class = pymod['C'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
-        self.assertEquals(c_class, b_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
+        self.assertEqual(c_class, b_var.get_type())
 
     def test_tuple_assignments_for_iteritems_in_fors(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_simple_tuple_assignments(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_overriding_builtin_names(self):
         self.mod.write('class C(object):\n    pass\nlist = C\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         list_var = pymod['list'].get_object()
-        self.assertEquals(c_class, list_var)
+        self.assertEqual(c_class, list_var)
 
     def test_simple_builtin_scope_test(self):
         self.mod.write('l = list()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_making_tuples_using_the_passed_argument_to_init(self):
         self.mod.write('class C(object):\n    pass\nl1 = [C()]\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_making_sets_using_the_passed_argument_to_init(self):
         self.mod.write('class C(object):\n    pass\nl1 = [C()]\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_making_dicts_using_the_passed_argument_to_init(self):
         self.mod.write('class C1(object):\n    pass\nclass C2(object):\n    pass\n'
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_range_builtin_function(self):
         self.mod.write('l = range(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_sorted_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_super_builtin_function(self):
         self.mod.write(
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_file_builtin_type(self):
         self.mod.write('for line in open("file.txt"):\n    a_var = line\n')
         self.mod.write('l = lambda: 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
         l_var = pymod['l'].get_object()
-        self.assertEquals(pyobjects.get_base_type('Function'),
+        self.assertEqual(pyobjects.get_base_type('Function'),
                           l_var.get_type())
 
     def test_lambda_function_definition(self):
         pymod = self.pycore.resource_to_pyobject(self.mod)
         l_var = pymod['l'].get_object()
         self.assertTrue(l_var.get_name() is not None)
-        self.assertEquals(len(l_var.get_param_names()), 4)
-        self.assertEquals((pymod, 1),
+        self.assertEqual(len(l_var.get_param_names()), 4)
+        self.assertEqual((pymod, 1),
                           pymod['l'].get_definition_location())
 
     def test_lambdas_that_return_unknown(self):
         c2_class = pymod['C2'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
 
     def test_builtin_zip_function_with_more_than_two_args(self):
         self.mod.write(
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
         c_var = pymod['c'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
-        self.assertEquals(c2_class, b_var.get_type())
-        self.assertEquals(c1_class, c_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
+        self.assertEqual(c2_class, b_var.get_type())
+        self.assertEqual(c1_class, c_var.get_type())
 
     def test_wrong_arguments_to_zip_function(self):
         self.mod.write(
         c1_class = pymod['C1'].get_object()
         a_var = pymod['a'].get_object()
         b_var = pymod['b'].get_object()
-        self.assertEquals(c1_class, a_var.get_type())
+        self.assertEqual(c1_class, a_var.get_type())
 
     def test_enumerate_builtin_function(self):
         self.mod.write('class C(object):\n    pass\nl = [C()]\n'
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_builtin_class_get_name(self):
-        self.assertEquals('object',
+        self.assertEqual('object',
                           builtins.builtins['object'].get_object().get_name())
-        self.assertEquals('property',
+        self.assertEqual('property',
                           builtins.builtins['property'].get_object().get_name())
 
     def test_star_args_and_double_star_args(self):
         pymod = self.pycore.resource_to_pyobject(self.mod)
         c_class = pymod['C'].get_object()
         a_var = pymod['a_var'].get_object()
-        self.assertEquals(c_class, a_var.get_type())
+        self.assertEqual(c_class, a_var.get_type())
 
     def test_simple_int_type(self):
         self.mod.write('l = 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['int'].get_object(),
+        self.assertEqual(builtins.builtins['int'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_simple_float_type(self):
         self.mod.write('l = 1.0\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['float'].get_object(),
+        self.assertEqual(builtins.builtins['float'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_simple_float_type2(self):
         self.mod.write('l = 1e1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['float'].get_object(),
+        self.assertEqual(builtins.builtins['float'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_simple_complex_type(self):
         self.mod.write('l = 1.0j\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['complex'].get_object(),
+        self.assertEqual(builtins.builtins['complex'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_handling_unaryop_on_ints(self):
         self.mod.write('l = -(1)\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['int'].get_object(),
+        self.assertEqual(builtins.builtins['int'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_handling_binop_on_ints(self):
         self.mod.write('l = 1 + 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['int'].get_object(),
+        self.assertEqual(builtins.builtins['int'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_handling_compares(self):
         self.mod.write('l = 1 == 1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['bool'].get_object(),
+        self.assertEqual(builtins.builtins['bool'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_handling_boolops(self):
         self.mod.write('l = 1 and 2\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals(builtins.builtins['int'].get_object(),
+        self.assertEqual(builtins.builtins['int'].get_object(),
                           pymod['l'].get_object().get_type())
 
     def test_binary_or_left_value_unknown(self):
         code = 'var = (asdsd or 3)\n'
         pymod = self.pycore.get_string_module(code)
-        self.assertEquals(builtins.builtins['int'].get_object(),
+        self.assertEqual(builtins.builtins['int'].get_object(),
                           pymod['var'].get_object().get_type())
 
     def test_unknown_return_object(self):

ropetest/codeanalyzetest.py

 
     def test_source_lines_simple(self):
         to_lines = SourceLinesAdapter('line1\nline2\n')
-        self.assertEquals('line1', to_lines.get_line(1))
-        self.assertEquals('line2', to_lines.get_line(2))
-        self.assertEquals('', to_lines.get_line(3))
-        self.assertEquals(3, to_lines.length())
+        self.assertEqual('line1', to_lines.get_line(1))
+        self.assertEqual('line2', to_lines.get_line(2))
+        self.assertEqual('', to_lines.get_line(3))
+        self.assertEqual(3, to_lines.length())
 
     def test_source_lines_get_line_number(self):
         to_lines = SourceLinesAdapter('line1\nline2\n')
-        self.assertEquals(1, to_lines.get_line_number(0))
-        self.assertEquals(1, to_lines.get_line_number(5))
-        self.assertEquals(2, to_lines.get_line_number(7))
-        self.assertEquals(3, to_lines.get_line_number(12))
+        self.assertEqual(1, to_lines.get_line_number(0))
+        self.assertEqual(1, to_lines.get_line_number(5))
+        self.assertEqual(2, to_lines.get_line_number(7))
+        self.assertEqual(3, to_lines.get_line_number(12))
 
     def test_source_lines_get_line_start(self):
         to_lines = SourceLinesAdapter('line1\nline2\n')
-        self.assertEquals(0, to_lines.get_line_start(1))
-        self.assertEquals(6, to_lines.get_line_start(2))
-        self.assertEquals(12, to_lines.get_line_start(3))
+        self.assertEqual(0, to_lines.get_line_start(1))
+        self.assertEqual(6, to_lines.get_line_start(2))
+        self.assertEqual(12, to_lines.get_line_start(3))
 
     def test_source_lines_get_line_end(self):
         to_lines = SourceLinesAdapter('line1\nline2\n')
-        self.assertEquals(5, to_lines.get_line_end(1))
-        self.assertEquals(11, to_lines.get_line_end(2))
-        self.assertEquals(12, to_lines.get_line_end(3))
+        self.assertEqual(5, to_lines.get_line_end(1))
+        self.assertEqual(11, to_lines.get_line_end(2))
+        self.assertEqual(12, to_lines.get_line_end(3))
 
     def test_source_lines_last_line_with_no_new_line(self):
         to_lines = SourceLinesAdapter('line1')
-        self.assertEquals(1, to_lines.get_line_number(5))
+        self.assertEqual(1, to_lines.get_line_number(5))
 
 
 class WordRangeFinderTest(unittest.TestCase):
 
     def test_keyword_before_parens(self):
         code = 'if (a_var).an_attr:\n    pass\n'
-        self.assertEquals('(a_var).an_attr',
+        self.assertEqual('(a_var).an_attr',
                           self._find_primary(code, code.index(':')))
 
     def test_inside_parans(self):
         code = 'a_func(a_var)'
-        self.assertEquals('a_var', self._find_primary(code, 10))
+        self.assertEqual('a_var', self._find_primary(code, 10))
 
     def test_simple_names(self):
         code = 'a_var = 10'
-        self.assertEquals('a_var', self._find_primary(code, 3))
+        self.assertEqual('a_var', self._find_primary(code, 3))
 
     def test_function_calls(self):
         code = 'sample_function()'
-        self.assertEquals('sample_function', self._find_primary(code, 10))
+        self.assertEqual('sample_function', self._find_primary(code, 10))
 
     def test_attribute_accesses(self):
         code = 'a_var.an_attr'
-        self.assertEquals('a_var.an_attr', self._find_primary(code, 10))
+        self.assertEqual('a_var.an_attr', self._find_primary(code, 10))
 
     def test_word_finder_on_word_beginning(self):
         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)
+        self.assertEqual('a_var', result)
 
     def test_word_finder_on_primary_beginning(self):
         code = 'print(a_var)\n'
         result = self._find_primary(code, code.index('a_var'))
-        self.assertEquals('a_var', result)
+        self.assertEqual('a_var', result)
 
     def test_word_finder_on_word_ending(self):
         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)
+        self.assertEqual('a_var', result)
 
     def test_word_finder_on_primary_ending(self):
         code = 'print(a_var)\n'
         result = self._find_primary(code, code.index('a_var') + 5)
-        self.assertEquals('a_var', result)
+        self.assertEqual('a_var', result)
 
     def test_word_finder_on_primaries_with_dots_inside_parens(self):
         code = '(a_var.\nattr)'
         result = self._find_primary(code, code.index('attr') + 1)
-        self.assertEquals('a_var.\nattr', result)
+        self.assertEqual('a_var.\nattr', result)
 
     def test_strings(self):
         code = '"a string".split()'
-        self.assertEquals('"a string".split', self._find_primary(code, 14))
+        self.assertEqual('"a string".split', self._find_primary(code, 14))
 
     def test_function_calls2(self):
         code = 'file("afile.txt").read()'
-        self.assertEquals('file("afile.txt").read', self._find_primary(code, 18))
+        self.assertEqual('file("afile.txt").read', self._find_primary(code, 18))
 
     def test_parens(self):
         code = '("afile.txt").split()'
-        self.assertEquals('("afile.txt").split', self._find_primary(code, 18))
+        self.assertEqual('("afile.txt").split', self._find_primary(code, 18))
 
     def test_function_with_no_param(self):
         code = 'AClass().a_func()'
-        self.assertEquals('AClass().a_func', self._find_primary(code, 12))
+        self.assertEqual('AClass().a_func', self._find_primary(code, 12))
 
     def test_function_with_multiple_param(self):
         code = 'AClass(a_param, another_param, "a string").a_func()'
-        self.assertEquals('AClass(a_param, another_param, "a string").a_func',
+        self.assertEqual('AClass(a_param, another_param, "a string").a_func',
                           self._find_primary(code, 44))
 
     def test_param_expressions(self):
         code = 'AClass(an_object.an_attr).a_func()'
-        self.assertEquals('an_object.an_attr', self._find_primary(code, 20))
+        self.assertEqual('an_object.an_attr', self._find_primary(code, 20))
 
     def test_string_parens(self):
         code = 'a_func("(").an_attr'
-        self.assertEquals('a_func("(").an_attr', self._find_primary(code, 16))
+        self.assertEqual('a_func("(").an_attr', self._find_primary(code, 16))
 
     def test_extra_spaces(self):
         code = 'a_func  (  "(" ) .   an_attr'
-        self.assertEquals('a_func  (  "(" ) .   an_attr',
+        self.assertEqual('a_func  (  "(" ) .   an_attr',
                           self._find_primary(code, 26))
 
     def test_functions_on_ending_parens(self):
         code = 'A()'
-        self.assertEquals('A()', self._find_primary(code, 2))
+        self.assertEqual('A()', self._find_primary(code, 2))
 
     def test_splitted_statement(self):
         word_finder = worder.Worder('an_object.an_attr')
-        self.assertEquals(('an_object', 'an_at', 10),
+        self.assertEqual(('an_object', 'an_at', 10),
                           word_finder.get_splitted_primary_before(15))
 
     def test_empty_splitted_statement(self):
         word_finder = worder.Worder('an_attr')
-        self.assertEquals(('', 'an_at', 0),
+        self.assertEqual(('', 'an_at', 0),
                           word_finder.get_splitted_primary_before(5))
 
     def test_empty_splitted_statement2(self):
         word_finder = worder.Worder('an_object.')
-        self.assertEquals(('an_object', '', 10),
+        self.assertEqual(('an_object', '', 10),
                           word_finder.get_splitted_primary_before(10))
 
     def test_empty_splitted_statement3(self):
         word_finder = worder.Worder('')
-        self.assertEquals(('', '', 0),
+        self.assertEqual(('', '', 0),
                           word_finder.get_splitted_primary_before(0))
 
     def test_empty_splitted_statement4(self):
         word_finder = worder.Worder('a_var = ')
-        self.assertEquals(('', '', 8),
+        self.assertEqual(('', '', 8),
                           word_finder.get_splitted_primary_before(8))
 
     def test_empty_splitted_statement5(self):
         word_finder = worder.Worder('a.')
-        self.assertEquals(('a', '', 2),
+        self.assertEqual(('a', '', 2),
                           word_finder.get_splitted_primary_before(2))
 
     def test_operators_inside_parens(self):
         code = '(a_var + another_var).reverse()'
-        self.assertEquals('(a_var + another_var).reverse',
+        self.assertEqual('(a_var + another_var).reverse',
                           self._find_primary(code, 25))
 
     def test_dictionaries(self):
         code = 'print({1: "one", 2: "two"}.keys())'
-        self.assertEquals('{1: "one", 2: "two"}.keys',
+        self.assertEqual('{1: "one", 2: "two"}.keys',
                           self._find_primary(code, 29))
 
     def test_following_parens(self):
         code = 'a_var = a_func()()'
         result = self._find_primary(code, code.index(')(') + 3)
-        self.assertEquals('a_func()()', result)
+        self.assertEqual('a_func()()', result)
 
     def test_comments_for_finding_statements(self):
         code = '# var2 . \n  var3'
-        self.assertEquals('var3', self._find_primary(code, code.index('3')))
+        self.assertEqual('var3', self._find_primary(code, code.index('3')))
 
     def test_str_in_comments_for_finding_statements(self):
         code = '# "var2" . \n  var3'
-        self.assertEquals('var3', self._find_primary(code, code.index('3')))
+        self.assertEqual('var3', self._find_primary(code, code.index('3')))
 
     def test_comments_for_finding_statements2(self):
         code = 'var1 + "# var2".\n  var3'
-        self.assertEquals('var3', self._find_primary(code, 21))
+        self.assertEqual('var3', self._find_primary(code, 21))
 
     def test_comments_for_finding_statements3(self):
         code = '"" + # var2.\n  var3'
-        self.assertEquals('var3', self._find_primary(code, 21))
+        self.assertEqual('var3', self._find_primary(code, 21))
 
     def test_import_statement_finding(self):
         code = 'import mod\na_var = 10\n'
         code = 's = str()\ns.title()\n'
         word_finder = worder.Worder(code)
         result = word_finder.get_word_parens_range(code.rindex('()') - 1)
-        self.assertEquals((len(code) - 3, len(code) - 1), result)
+        self.assertEqual((len(code) - 3, len(code) - 1), result)
 
     def test_getting_primary_before_get_index(self):
         code = '\na = (b + c).d[0]()\n'
         result = self._find_primary(code, len(code) - 2)
-        self.assertEquals('(b + c).d[0]()', result)
+        self.assertEqual('(b + c).d[0]()', result)
 
     def test_getting_primary_and_strings_at_the_end_of_line(self):
         code = 'f(\'\\\'\')\n'
     def test_getting_primary_and_not_crossing_newlines(self):
         code = '\na = (b + c)\n(4 + 1).x\n'
         result = self._find_primary(code, len(code) - 1)
-        self.assertEquals('(4 + 1).x', result)
+        self.assertEqual('(4 + 1).x', result)
 
     # XXX: cancatenated string literals
     def xxx_test_getting_primary_cancatenating_strs(self):
         code = 's = "a"\n"b" "c"\n'
         result = self._find_primary(code, len(code) - 2)
-        self.assertEquals('"b" "c"', result)
+        self.assertEqual('"b" "c"', result)
 
     def test_is_a_function_being_called_with_parens_on_next_line(self):
         code = 'func\n(1, 2)\n'
     def xxx_test_triple_quotes(self):
         code = 's = """string"""\n'
         result = self._find_primary(code, len(code) - 1)
-        self.assertEquals('"""string"""', result)
+        self.assertEqual('"""string"""', result)
 
     def test_triple_quotes_spanning_multiple_lines(self):
         code = 's = """\\\nl1\nl2\n """\n'
         result = self._find_primary(code, len(code) - 2)
-        self.assertEquals('"""\\\nl1\nl2\n """', result)
+        self.assertEqual('"""\\\nl1\nl2\n """', result)
 
     def test_get_word_parens_range_and_string_literals(self):
         code = 'f(1, ")", 2)\n'
         word_finder = worder.Worder(code)
         result = word_finder.get_word_parens_range(0)
-        self.assertEquals((1, len(code) - 1), result)
+        self.assertEqual((1, len(code) - 1), result)
 
     def test_is_assigned_here_for_equality_test(self):
         code = 'a == 1\n'
     def test_find_parens_start(self):
         code = 'f(p)\n'
         finder = worder.Worder(code)
-        self.assertEquals(1, finder.find_parens_start_from_inside(2))
+        self.assertEqual(1, finder.find_parens_start_from_inside(2))
 
     def test_underlined_find_parens_start(self):
         code = 'f(p="")\n'
         finder = worder.Worder(code)
-        self.assertEquals(1, finder._find_parens_start(len(code) - 2))
+        self.assertEqual(1, finder._find_parens_start(len(code) - 2))
 
     def test_find_parens_start_with_multiple_entries(self):
         code = 'myfunc(p1, p2, p3\n'
         finder = worder.Worder(code)
-        self.assertEquals(code.index('('),
+        self.assertEqual(code.index('('),
                           finder.find_parens_start_from_inside(len(code) - 1))
 
     def test_find_parens_start_with_nested_parens(self):
         code = 'myfunc(p1, (p2, p3), p4\n'
         finder = worder.Worder(code)
-        self.assertEquals(code.index('('),
+        self.assertEqual(code.index('('),
                           finder.find_parens_start_from_inside(len(code) - 1))
 
     def test_find_parens_start_with_parens_in_strs(self):
         code = 'myfunc(p1, "(", p4\n'
         finder = worder.Worder(code)
-        self.assertEquals(code.index('('),
+        self.assertEqual(code.index('('),
                           finder.find_parens_start_from_inside(len(code) - 1))
 
     def test_find_parens_start_with_parens_in_strs_in_multiple_lines(self):
         code = 'myfunc  (\np1\n , \n "(" \n, \np4\n'
         finder = worder.Worder(code)
-        self.assertEquals(code.index('('),
+        self.assertEqual(code.index('('),
                           finder.find_parens_start_from_inside(len(code) - 1))
 
     def test_is_on_function_keyword(self):
         scope = self.pycore.get_string_scope(code)
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         result = name_finder.get_pyname_at(len(code) - 3)
-        self.assertEquals(scope['a_var'], result)
+        self.assertEqual(scope['a_var'], result)
 
     def test_class_variable_attribute_in_class_body(self):
         code = 'a_var = 10\nclass C(object):\n    a_var = a_var\n'
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_var_pyname = scope['C'].get_object()['a_var']
         result = name_finder.get_pyname_at(len(code) - 12)
-        self.assertEquals(a_var_pyname, result)
+        self.assertEqual(a_var_pyname, result)
 
     def test_class_variable_attribute_in_class_body2(self):
         code = 'a_var = 10\nclass C(object):\n    a_var \\\n= a_var\n'
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_var_pyname = scope['C'].get_object()['a_var']
         result = name_finder.get_pyname_at(len(code) - 12)
-        self.assertEquals(a_var_pyname, result)
+        self.assertEqual(a_var_pyname, result)
 
     def test_class_method_attribute_in_class_body(self):
         code = 'class C(object):\n    def a_method(self):\n        pass\n'
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_method_pyname = scope['C'].get_object()['a_method']
         result = name_finder.get_pyname_at(code.index('a_method') + 2)
-        self.assertEquals(a_method_pyname, result)
+        self.assertEqual(a_method_pyname, result)
 
     def test_inner_class_attribute_in_class_body(self):
         code = 'class C(object):\n    class CC(object):\n        pass\n'
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         a_class_pyname = scope['C'].get_object()['CC']
         result = name_finder.get_pyname_at(code.index('CC') + 2)
-        self.assertEquals(a_class_pyname, result)
+        self.assertEqual(a_class_pyname, result)
 
     def test_class_method_in_class_body_but_not_indexed(self):
         code = 'class C(object):\n    def func(self, func):\n        pass\n'
         a_func_pyname = scope.get_scopes()[0].get_scopes()[0]['func']
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         result = name_finder.get_pyname_at(code.index(', func') + 3)
-        self.assertEquals(a_func_pyname, result)
+        self.assertEqual(a_func_pyname, result)
 
     def test_function_but_not_indexed(self):
         code = 'def a_func(a_func):\n    pass\n'
         a_func_pyname = scope['a_func']
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         result = name_finder.get_pyname_at(code.index('a_func') + 3)
-        self.assertEquals(a_func_pyname, result)
+        self.assertEqual(a_func_pyname, result)
 
     def test_modules_after_from_statements(self):
         root_folder = self.project.root
         name_finder = rope.base.evaluate.ScopeNameFinder(scope.pyobject)
         mod_pyobject = self.pycore.resource_to_pyobject(mod)
         found_pyname = name_finder.get_pyname_at(code.index('mod') + 1)
-        self.assertEquals(mod_pyobject, found_pyname.get_object())
+        self.assertEqual(mod_pyobject, found_pyname.get_object())
 
     def test_renaming_functions_with_from_import_and_parens(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         mod_pyobject = self.pycore.resource_to_pyobject(mod1)
         afunc = mod_pyobject['afunc']
         found_pyname = name_finder.get_pyname_at(code.index('afunc') + 1)
-        self.assertEquals(afunc.get_object(), found_pyname.get_object())
+        self.assertEqual(afunc.get_object(), found_pyname.get_object())
 
     @testutils.run_only_for_25
     def test_relative_modules_after_from_statements(self):
         name_finder = rope.base.evaluate.ScopeNameFinder(mod2_scope.pyobject)
         mod1_pyobject = self.pycore.resource_to_pyobject(mod1)
         found_pyname = name_finder.get_pyname_at(code.index('mod1') + 1)
-        self.assertEquals(mod1_pyobject, found_pyname.get_object())
+        self.assertEqual(mod1_pyobject, found_pyname.get_object())
 
     def test_relative_modules_after_from_statements2(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         name_finder = rope.base.evaluate.ScopeNameFinder(mod1_scope.pyobject)
         pkg2_pyobject = self.pycore.resource_to_pyobject(pkg2)
         found_pyname = name_finder.get_pyname_at(mod1.read().index('pkg2') + 1)
-        self.assertEquals(pkg2_pyobject, found_pyname.get_object())
+        self.assertEqual(pkg2_pyobject, found_pyname.get_object())
 
     @testutils.assert_raises(exceptions.RopeError)
     def test_get_pyname_at_on_language_keywords(self):
         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)
+        self.assertEqual(pymod['var'], pyname)
 
     def test_one_liners_with_line_breaks(self):
         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)
+        self.assertEqual(pymod['var'], pyname)
 
     def test_one_liners_with_line_breaks2(self):
         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(pymod['var'], pyname)
+        self.assertEqual(pymod['var'], pyname)
 
 
 class LogicalLineFinderTest(unittest.TestCase):
     def test_normal_lines(self):
         code = 'a_var = 10'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 1), line_finder.logical_line_in(1))
+        self.assertEqual((1, 1), line_finder.logical_line_in(1))
 
     def test_normal_lines2(self):
         code = 'another = 10\na_var = 20\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 1), line_finder.logical_line_in(1))
-        self.assertEquals((2, 2), line_finder.logical_line_in(2))
+        self.assertEqual((1, 1), line_finder.logical_line_in(1))
+        self.assertEqual((2, 2), line_finder.logical_line_in(2))
 
     def test_implicit_continuation(self):
         code = 'a_var = 3 + \\\n    4 + \\\n    5'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 3), line_finder.logical_line_in(2))
+        self.assertEqual((1, 3), line_finder.logical_line_in(2))
 
     def test_explicit_continuation(self):
         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.assertEqual((2, 4), line_finder.logical_line_in(2))
 
     def test_explicit_continuation_comments(self):
         code = '#\na_var = 3\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((2, 2), line_finder.logical_line_in(2))
+        self.assertEqual((2, 2), line_finder.logical_line_in(2))
 
     def test_multiple_indented_ifs(self):
         code = 'if True:\n    if True:\n        if True:\n            pass\n    a = 10\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((5, 5), line_finder.logical_line_in(5))
+        self.assertEqual((5, 5), line_finder.logical_line_in(5))
 
     def test_list_comprehensions_and_fors(self):
         code = 'a_list = [i\n    for i in range(10)]\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 2), line_finder.logical_line_in(2))
+        self.assertEqual((1, 2), line_finder.logical_line_in(2))
 
     def test_generator_expressions_and_fors(self):
         code = 'a_list = (i\n    for i in range(10))\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 2), line_finder.logical_line_in(2))
+        self.assertEqual((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'
-        self.assertEquals(2, get_block_start(SourceLinesAdapter(code), 2))
+        self.assertEqual(2, get_block_start(SourceLinesAdapter(code), 2))
 
     def test_problems_with_inner_indentations(self):
         code = 'if True:\n    if True:\n        if True:\n            pass\n' \
                '    a = \\\n        1\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((5, 6), line_finder.logical_line_in(6))
+        self.assertEqual((5, 6), line_finder.logical_line_in(6))
 
     def test_problems_with_inner_indentations2(self):
         code = 'if True:\n    if True:\n        pass\n' \
                'a = 1\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((4, 4), line_finder.logical_line_in(4))
+        self.assertEqual((4, 4), line_finder.logical_line_in(4))
 
     def test_logical_lines_for_else(self):
         code = 'if True:\n    pass\nelse:\n    pass\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals((3, 3), line_finder.logical_line_in(3))
+        self.assertEqual((3, 3), line_finder.logical_line_in(3))
 
     def test_logical_lines_for_lines_with_wrong_continues(self):
         code = 'var = 1 + \\'
         line_finder = self._logical_finder(code)
-        self.assertEquals((1, 1), line_finder.logical_line_in(1))
+        self.assertEqual((1, 1), line_finder.logical_line_in(1))
 
     def test_generating_line_starts(self):
         code = 'a = 1\na = 2\n\na = 3\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals([1, 2, 4], list(line_finder.generate_starts()))
+        self.assertEqual([1, 2, 4], list(line_finder.generate_starts()))
 
     def test_generating_line_starts2(self):
         code = 'a = 1\na = 2\n\na = \\ 3\n'
         line_finder = LogicalLineFinder(SourceLinesAdapter(code))
-        self.assertEquals([2, 4], list(line_finder.generate_starts(2)))
+        self.assertEqual([2, 4], list(line_finder.generate_starts(2)))
 
     def test_generating_line_starts3(self):
         code = 'a = 1\na = 2\n\na = \\ 3\n'
         line_finder = LogicalLineFinder(SourceLinesAdapter(code))
-        self.assertEquals([2], list(line_finder.generate_starts(2, 3)))
+        self.assertEqual([2], list(line_finder.generate_starts(2, 3)))
 
     def test_generating_line_starts_for_multi_line_statements(self):
         code = '\na = \\\n 1 + \\\n 1\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals([2], list(line_finder.generate_starts()))
+        self.assertEqual([2], list(line_finder.generate_starts()))
 
     def test_generating_line_starts_and_unmatched_deindents(self):
         code = 'if True:\n    if True:\n        if True:\n' \
                '            a = 1\n    b = 1\n'
         line_finder = self._logical_finder(code)
-        self.assertEquals([4, 5], list(line_finder.generate_starts(4)))
+        self.assertEqual([4, 5], list(line_finder.generate_starts(4)))
 
 class TokenizerLogicalLineFinderTest(LogicalLineFinderTest):
 

ropetest/contrib/finderrorstest.py

     def test_unresolved_variables(self):
         self.mod.write('print(var)\n')
         result = finderrors.find_errors(self.project, self.mod)
-        self.assertEquals(1, len(result))
-        self.assertEquals(1, result[0].lineno)
+        self.assertEqual(1, len(result))
+        self.assertEqual(1, result[0].lineno)
 
     def test_defined_later(self):
         self.mod.write('print(var)\nvar = 1\n')
         result = finderrors.find_errors(self.project, self.mod)
-        self.assertEquals(1, len(result))
-        self.assertEquals(1, result[0].lineno)
+        self.assertEqual(1, len(result))
+        self.assertEqual(1, result[0].lineno)
 
     def test_ignoring_builtins(self):
         self.mod.write('range(2)\n')
         result = finderrors.find_errors(self.project, self.mod)
-        self.assertEquals(0, len(result))
+        self.assertEqual(0, len(result))
 
     def test_ignoring_none(self):
         self.mod.write('var = None\n')
         result = finderrors.find_errors(self.project, self.mod)
-        self.assertEquals(0, len(result))
+        self.assertEqual(0, len(result))
 
     def test_bad_attributes(self):
         code = 'class C(object):\n' \
                'print(c.var)\n'
         self.mod.write(code)
         result = finderrors.find_errors(self.project, self.mod)
-        self.assertEquals(1, len(result))
-        self.assertEquals(4, result[0].lineno)
+        self.assertEqual(1, len(result))
+        self.assertEqual(4, result[0].lineno)
 
 
 if __name__ == '__main__':

ropetest/contrib/findittest.py

         mod = testutils.create_module(self.project, 'mod')
         mod.write('a_var = 1\n')
         result = find_occurrences(self.project, mod, 1)
-        self.assertEquals(mod, result[0].resource)
-        self.assertEquals(0, result[0].offset)
-        self.assertEquals(False, result[0].unsure)
+        self.assertEqual(mod, result[0].resource)
+        self.assertEqual(0, result[0].offset)
+        self.assertEqual(False, result[0].unsure)
 
     def test_finding_occurrences_in_more_than_one_module(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         mod1.write('a_var = 1\n')
         mod2.write('import mod1\nmy_var = mod1.a_var')
         result = find_occurrences(self.project, mod1, 1)
-        self.assertEquals(2, len(result))
+        self.assertEqual(2, len(result))
         modules = (result[0].resource, result[1].resource)
         self.assertTrue(mod1 in modules and mod2 in modules)
 
                    'def f(arg):\n    arg.a_func()\n')
         result = find_occurrences(
             self.project, mod1, mod1.read().index('a_func'), unsure=True)
-        self.assertEquals(2, len(result))
+        self.assertEqual(2, len(result))
 
     def test_find_occurrences_resources_parameter(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         mod1.write('a_var = 1\n')
         mod2.write('import mod1\nmy_var = mod1.a_var')
         result = find_occurrences(self.project, mod1, 1, resources=[mod1])
-        self.assertEquals(1, len(result))
-        self.assertEquals((mod1, 0), (result[0].resource, result[0].offset))
+        self.assertEqual(1, len(result))
+        self.assertEqual((mod1, 0), (result[0].resource, result[0].offset))
 
     def test_find_occurrences_and_class_hierarchies(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         result1 = find_occurrences(self.project, mod1, offset)
         result2 = find_occurrences(self.project, mod1,
                                    offset, in_hierarchy=True)
-        self.assertEquals(1, len(result1))
-        self.assertEquals(2, len(result2))
+        self.assertEqual(1, len(result1))
+        self.assertEqual(2, len(result2))
 
     def test_trivial_find_implementations(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         mod1.write('class A(object):\n    def f(self):\n        pass\n')
         offset = mod1.read().rindex('f(')
         result = find_implementations(self.project, mod1, offset)
-        self.assertEquals([], result)
+        self.assertEqual([], result)
 
     def test_find_implementations_and_not_returning_parents(self):
         mod1 = testutils.create_module(self.project, 'mod1')
                    'class B(A):\n    def f(self):\n        pass\n')
         offset = mod1.read().rindex('f(')
         result = find_implementations(self.project, mod1, offset)
-        self.assertEquals([], result)
+        self.assertEqual([], result)
 
     def test_find_implementations_real_implementation(self):
         mod1 = testutils.create_module(self.project, 'mod1')
                    'class B(A):\n    def f(self):\n        pass\n')
         offset = mod1.read().index('f(')
         result = find_implementations(self.project, mod1, offset)
-        self.assertEquals(1, len(result))
-        self.assertEquals(mod1.read().rindex('f('), result[0].offset)
+        self.assertEqual(1, len(result))
+        self.assertEqual(mod1.read().rindex('f('), result[0].offset)
 
     @testutils.assert_raises(exceptions.BadIdentifierError)
     def test_find_implementations_real_implementation(self):
         code = 'def a_func():\n    pass\na_func()'
         result = find_definition(self.project, code, code.rindex('a_func'))
         start = code.index('a_func')
-        self.assertEquals(start, result.offset)
-        self.assertEquals(None, result.resource)
-        self.assertEquals(1, result.lineno)
-        self.assertEquals((start, start + len('a_func')), result.region)
+        self.assertEqual(start, result.offset)
+        self.assertEqual(None, result.resource)
+        self.assertEqual(1, result.lineno)
+        self.assertEqual((start, start + len('a_func')), result.region)
 
     def test_find_definition_in_other_modules(self):
         mod1 = testutils.create_module(self.project, 'mod1')
         mod1.write('var = 1\n')
         code = 'import mod1\nprint(mod1.var)\n'
         result = find_definition(self.project, code, code.index('var'))
-        self.assertEquals(mod1, result.resource)
-        self.assertEquals(0, result.offset)
+        self.assertEqual(mod1, result.resource)
+        self.assertEqual(0, result.offset)
 
 
 def suite():

ropetest/contrib/fixmodnamestest.py

         self.project.do(FixModuleNames(self.project).get_changes(_fixer))
         newmod1 = self.project.get_resource('_od1.py')
         newmod2 = self.project.get_resource('_od2.py')
-        self.assertEquals('import _od2\n', newmod1.read())
-        self.assertEquals('import _od1\n', newmod2.read())
+        self.assertEqual('import _od2\n', newmod1.read())
+        self.assertEqual('import _od1\n', newmod2.read())
 
     def test_handling_nested_modules(self):
         pkg = create_package(self.project, 'xkg')

ropetest/contrib/generatetest.py

         code = 'a_var = name\n'
         self.mod.write(code)
         generator = self._get_generate(code.index('name'))
-        self.assertEquals((self.mod, 1), generator.get_location())
+        self.assertEqual((self.mod, 1), generator.get_location())
 
     def test_generating_variable(self):
         code = 'a_var = name\n'
         self.mod.write(code)
         changes = self._get_generate(code.index('name')).get_changes()
         self.project.do(changes)
-        self.assertEquals('name = None\n\n\na_var = name\n', self.mod.read())
+        self.assertEqual('name = None\n\n\na_var = name\n', self.mod.read())
 
     def test_generating_variable_inserting_before_statement(self):
         code = 'c = 1\nc = b\n'
         self.mod.write(code)
         changes = self._get_generate(code.index('b')).get_changes()
         self.project.do(changes)
-        self.assertEquals('c = 1\nb = None\n\n\nc = b\n', self.mod.read())
+        self.assertEqual('c = 1\nb = None\n\n\nc = b\n', self.mod.read())
 
     def test_generating_variable_in_local_scopes(self):
         code = 'def f():\n    c = 1\n    c = b\n'
         self.mod.write(code)
         changes = self._get_generate(code.index('b')).get_changes()
         self.project.do(changes)
-        self.assertEquals('def f():\n    c = 1\n    b = None\n    c = b\n',
+        self.assertEqual('def f():\n    c = 1\n    b = None\n    c = b\n',
                           self.mod.read())
 
     def test_generating_variable_in_other_modules(self):
         self.mod.write(code)
         generator = self._get_generate(code.index('b'))
         self.project.do(generator.get_changes())
-        self.assertEquals((self.mod2, 1), generator.get_location())
-        self.assertEquals('b = None\n', self.mod2.read())
+        self.assertEqual((self.mod2, 1), generator.get_location())
+        self.assertEqual('b = None\n', self.mod2.read())
 
     def test_generating_variable_in_classes(self):
         code = 'class C(object):\n    def f(self):\n        pass\n' \
         self.mod.write(code)
         changes = self._get_generate(code.index('attr')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n    def f(self):\n        pass\n\n    attr = None\n' \
             'c = C()\na_var = c.attr', self.mod.read())
 
         self.mod.write(code)
         changes = self._get_generate(code.index('attr')).get_changes()
         self.project.do(changes)
-        self.assertEquals('class C(object):\n\n    attr = None\n' \
+        self.assertEqual('class C(object):\n\n    attr = None\n' \
                           'c = C()\na_var = c.attr', self.mod.read())
 
     def test_generating_variable_in_packages(self):
         generator = self._get_generate(code.rindex('a'))
         self.project.do(generator.get_changes())
         init = self.pkg.get_child('__init__.py')
-        self.assertEquals((init, 1), generator.get_location())
-        self.assertEquals('a = None\n', init.read())
+        self.assertEqual((init, 1), generator.get_location())
+        self.assertEqual('a = None\n', init.read())
 
     def test_generating_classes(self):
         code = 'c = C()\n'
         self.mod.write(code)
         changes = self._get_generate_class(code.index('C')).get_changes()
         self.project.do(changes)
-        self.assertEquals('class C(object):\n    pass\n\n\nc = C()\n',
+        self.assertEqual('class C(object):\n    pass\n\n\nc = C()\n',
                           self.mod.read())
 
     def test_generating_modules(self):
         generator = self._get_generate_module(code.rindex('mod'))
         self.project.do(generator.get_changes())
         mod = self.pkg.get_child('mod.py')
-        self.assertEquals((mod, 1), generator.get_location())
-        self.assertEquals('import pkg.mod\npkg.mod\n', self.mod.read())
+        self.assertEqual((mod, 1), generator.get_location())
+        self.assertEqual('import pkg.mod\npkg.mod\n', self.mod.read())
 
     def test_generating_packages(self):
         code = 'import pkg\npkg.pkg2\n'
         self.project.do(generator.get_changes())
         pkg2 = self.pkg.get_child('pkg2')
         init = pkg2.get_child('__init__.py')
-        self.assertEquals((init, 1), generator.get_location())
-        self.assertEquals('import pkg.pkg2\npkg.pkg2\n', self.mod.read())
+        self.assertEqual((init, 1), generator.get_location())
+        self.assertEqual('import pkg.pkg2\npkg.pkg2\n', self.mod.read())
 
     def test_generating_function(self):
         code = 'a_func()\n'
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals('def a_func():\n    pass\n\n\na_func()\n',
+        self.assertEqual('def a_func():\n    pass\n\n\na_func()\n',
                           self.mod.read())
 
     def test_generating_modules_with_empty_primary(self):
         generator = self._get_generate_module(code.rindex('mod'))
         self.project.do(generator.get_changes())
         mod = self.project.root.get_child('mod.py')
-        self.assertEquals((mod, 1), generator.get_location())
-        self.assertEquals('import mod\nmod\n', self.mod.read())
+        self.assertEqual((mod, 1), generator.get_location())
+        self.assertEqual('import mod\nmod\n', self.mod.read())
 
     @testutils.assert_raises(exceptions.RefactoringError)
     def test_generating_variable_already_exists(self):
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n\n    @staticmethod\n    def a_func():\n        pass\nC.a_func()\n',
             self.mod.read())
 
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n\n    def a_func(self):\n        pass\n'
             'c = C()\nc.a_func()\n',
             self.mod.read())
         self.mod.write(code)
         changes = self._get_generate_function(code.rindex('C')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n\n    def __init__(self):\n        pass\n'
             'c = C()\n',
             self.mod.read())
         self.mod.write(code)
         changes = self._get_generate_function(code.rindex('c')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n\n    def __call__(self):\n        pass\n'
             'c = C()\nc()\n',
             self.mod.read())
         self.mod.write(code)
         changes = self._get_generate_function(code.rindex('c')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'class C(object):\n\n    def __call__(self):\n        pass\n',
             self.mod2.read())
 
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals('def a_func(arg0):\n    pass\n\n\na_func(1)\n',
+        self.assertEqual('def a_func(arg0):\n    pass\n\n\na_func(1)\n',
                           self.mod.read())
 
     def test_generating_function_handling_keyword_xarguments(self):
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals('def a_func(p):\n    pass\n\n\na_func(p=1)\n',
+        self.assertEqual('def a_func(p):\n    pass\n\n\na_func(p=1)\n',
                           self.mod.read())
 
     def test_generating_function_handling_arguments_better_naming(self):
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals('a_var = 1\ndef a_func(a_var):\n    pass\n\n\na_func(a_var)\n',
+        self.assertEqual('a_var = 1\ndef a_func(a_var):\n    pass\n\n\na_func(a_var)\n',
                           self.mod.read())
 
     def test_generating_variable_in_other_modules2(self):
         self.mod.write(code)
         generator = self._get_generate(code.index('b'))
         self.project.do(generator.get_changes())
-        self.assertEquals((self.mod2, 5), generator.get_location())
-        self.assertEquals('\n\n\nprint(1)\n\n\nb = None\n', self.mod2.read())
+        self.assertEqual((self.mod2, 5), generator.get_location())
+        self.assertEqual('\n\n\nprint(1)\n\n\nb = None\n', self.mod2.read())
 
     def test_generating_function_in_a_suite(self):
         code = 'if True:\n    a_func()\n'
         self.mod.write(code)
         changes = self._get_generate_function(code.index('a_func')).get_changes()
         self.project.do(changes)
-        self.assertEquals('def a_func():\n    pass\n\n\nif True:\n    a_func()\n',
+        self.assertEqual('def a_func():\n    pass\n\n\nif True:\n    a_func()\n',
                           self.mod.read())
 
     def test_generating_function_in_a_suite_in_a_function(self):
         self.mod.write(code)
         changes = self._get_generate_function(code.index('g()')).get_changes()
         self.project.do(changes)
-        self.assertEquals(
+        self.assertEqual(
             'def f():\n    a = 1\n    def g():\n        pass\n'
             '    if 1:\n        g()\n',
             self.mod.read())

ropetest/historytest.py

         my_file = self.project.root.create_file('my_file.txt')
         my_file.write('text1')
         self.history.undo()
-        self.assertEquals('', my_file.read())
+        self.assertEqual('', my_file.read())
 
     def test_moving_files(self):
         my_file = self.project.root.create_file('my_file.txt')
         my_file.move('new_file.txt')
         self.history.undo()
-        self.assertEquals('', my_file.read())
+        self.assertEqual('', my_file.read())
 
     def test_moving_files_to_folders(self):
         my_file = self.project.root.create_file('my_file.txt')
         my_folder = self.project.root.create_folder('my_folder')
         my_file.move(my_folder.path)
         self.history.undo()
-        self.assertEquals('', my_file.read())
+        self.assertEqual('', my_file.read())
 
     def test_writing_files_that_does_not_change_contents(self):
         my_file = self.project.root.create_file('my_file.txt')
     def test_simple_undo(self):
         change = ChangeContents(self.file1, '1')
         self.history.do(change)
-        self.assertEquals('1', self.file1.read())
+        self.assertEqual('1', self.file1.read())
         self.history.undo()
-        self.assertEquals('', self.file1.read())
+        self.assertEqual('', self.file1.read())
 
     def test_tobe_undone(self):
         change1 = ChangeContents(self.file1, '1')
-        self.assertEquals(None, self.history.tobe_undone)
+        self.assertEqual(None, self.history.tobe_undone)
         self.history.do(change1)
-        self.assertEquals(change1, self.history.tobe_undone)
+        self.assertEqual(change1, self.history.tobe_undone)
         change2 = ChangeContents(self.file1, '2')
         self.history.do(change2)
-        self.assertEquals(change2, self.history.tobe_undone)
+        self.assertEqual(change2, self.history.tobe_undone)
         self.history.undo()
-        self.assertEquals(change1, self.history.tobe_undone)
+        self.assertEqual(change1, self.history.tobe_undone)
 
     def test_tobe_redone(self):
         change = ChangeContents(self.file1, '1')
         self.history.do(change)
-        self.assertEquals(None, self.history.tobe_redone)
+        self.assertEqual(None, self.history.tobe_redone)
         self.history.undo()
-        self.assertEquals(change, self.history.tobe_redone)
+        self.assertEqual(change, self.history.tobe_redone)
 
     @testutils.assert_raises(exceptions.HistoryError)
     def test_undo_limit(self):
             history.undo()
             history.undo()
         finally:
-            self.assertEquals('1', self.file1.read())
+            self.assertEqual('1', self.file1.read())
 
     def test_simple_redo(self):
         change = ChangeContents(self.file1, '1')
         self.history.do(change)
         self.history.undo()
         self.history.redo()
-        self.assertEquals('1', self.file1.read())
+        self.assertEqual('1', self.file1.read())
 
     def test_simple_re_undo(self):
         change = ChangeContents(self.file1, '1')
         self.history.undo()
         self.history.redo()
         self.history.undo()
-        self.assertEquals('', self.file1.read())
+        self.assertEqual('', self.file1.read())
 
     def test_multiple_undos(self):
         change = ChangeContents(self.file1, '1')
         change = ChangeContents(self.file1, '2')
         self.history.do(change)
         self.history.undo()
-        self.assertEquals('1', self.file1.read())
+        self.assertEqual('1', self.file1.read())
         change = ChangeContents(self.file1, '3')
         self.history.do(change)
         self.history.undo()
-        self.assertEquals('1', self.file1.read())
+        self.assertEqual('1', self.file1.read())
         self.history.redo()
-        self.assertEquals('3', self.file1.read())
+        self.assertEqual('3', self.file1.read())
 
     @testutils.assert_raises(exceptions.HistoryError)
     def test_undo_list_underflow(self):
         change = ChangeContents(self.file1, '1')
         self.history.do(change)
         self.history.undo(change)
-        self.assertEquals('', self.file1.read())
+        self.assertEqual('', self.file1.read())
         self.assertFalse(self.history.undo_list)
 
     def test_undoing_choosen_changes2(self):
         self.history.do(change1)
         self.history.do(ChangeContents(self.file1, '2'))
         self.history.undo(change1)
-        self.assertEquals('', self.file1.read())
+        self.assertEqual('', self.file1.read())
         self.assertFalse(self.history.undo_list)
 
     def test_undoing_choosen_changes_not_undoing_others(self):
         self.history.do(change1)
         self.history.do(ChangeContents(self.file2, '2'))
         self.history.undo(change1)
-        self.assertEquals('', self.file1.read())
-        self.assertEquals('2', self.file2.read())
+        self.assertEqual('', self.file1.read())
+        self.assertEqual('2', self.file2.read())
 
     def test_undoing_writing_after_moving(self):
         change1 = ChangeContents(self.file1, '1')
         self.history.do(MoveResource(self.file1, 'file3.txt'))
         file3 = self.project.get_resource('file3.txt')
         self.history.undo(change1)
-        self.assertEquals('', self.file1.read())
+        self.assertEqual('', self.file1.read())
         self.assertFalse(file3.exists())
 
     def test_undoing_folder_movements_for_undoing_writes_inside_it(self):
         self.history.do(MoveResource(folder, 'new_folder'))
         new_folder = self.project.get_resource('new_folder')
         self.history.undo(change1)
-        self.assertEquals('', file3.read())
+        self.assertEqual('', file3.read())
         self.assertFalse(new_folder.exists())
 
     def test_undoing_changes_that_depend_on_a_dependant_change(self):
         file3 = self.project.get_resource('file3.txt')
 
         self.history.undo(change1)
-        self.assertEquals('', self.file1.read())
-        self.assertEquals('', self.file2.read())
+        self.assertEqual('', self.file1.read())
+        self.assertEqual('', self.file2.read())
         self.assertFalse(file3.exists())
 
     def test_undoing_writes_for_undoing_folder_movements_containing_it(self):
         new_file = self.project.get_resource('new_folder/file3.txt')
         self.history.do(ChangeContents(new_file, '1'))
         self.history.undo(change1)
-        self.assertEquals('', old_file.read())
+        self.assertEqual('', old_file.read())
         self.assertFalse(new_file.exists())