def test_find_implementations_and_not_returning_parents(self): mod1 = testutils.create_module(self.project, 'mod1') mod1.write('class A(object):\n def f(self):\n pass\n' '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)
def test_find_implementations_real_implementation(self): mod1 = testutils.create_module(self.project, 'mod1') mod1.write('class A(object):\n def f(self):\n pass\n' '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)
def test_trivial_find_implementations(self): mod1 = testutils.create_module(self.project, "mod1") mod1.write( dedent("""\ class A(object): def f(self): pass """) ) offset = mod1.read().rindex("f(") result = find_implementations(self.project, mod1, offset) self.assertEqual([], result)
def test_find_implementations_real_implementation(self): mod1 = testutils.create_module(self.project, "mod1") mod1.write( dedent("""\ class A(object): def f(self): pass class B(A): def f(self): pass """) ) offset = mod1.read().index("f(") result = find_implementations(self.project, mod1, offset) self.assertEqual(1, len(result)) self.assertEqual(mod1.read().rindex("f("), result[0].offset)
def test_find_implementations_real_implementation(self): mod1 = testutils.create_module(self.project, 'mod1') mod1.write('class A(object):\n pass\n') offset = mod1.read().index('A') result = find_implementations(self.project, mod1, offset)
def test_find_implementations_real_implementation_simple(self): mod1 = testutils.create_module(self.project, "mod1") mod1.write("class A(object):\n pass\n") offset = mod1.read().index("A") with self.assertRaises(exceptions.BadIdentifierError): find_implementations(self.project, mod1, offset)
def test_find_implementations_real_implementation_simple(self): mod1 = testutils.create_module(self.project, 'mod1') mod1.write('class A(object):\n pass\n') offset = mod1.read().index('A') with self.assertRaises(exceptions.BadIdentifierError): find_implementations(self.project, mod1, offset)
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.assertEqual([], result)