def test_get_focused_on_script_class_method(self): filename = self._script_file() with self._python_path(filename): functions = get_focused_on(filename, 'DummyClass.method') self.assertEqual(len(functions), 1) function = functions[0] self.assertEqual(function.func_code, DummyClass.method.func_code)
def test_focused_on_script_method(self): filename = self._script_file() with self._python_path(filename): functions = get_focused_on(filename, 'module_function') self.assertEqual(len(functions), 1) function = functions[0] self.assertEqual(function.func_code, module_function.func_code)
def test_get_focused_with_multiple_functions(self): filename = self._script_file() with self._python_path(filename): functions = get_focused_on( filename, 'module_function, DummyClass.method') self.assertEqual(len(functions), 2) self.assertEqual( [functions[0].func_code, functions[1].func_code], [module_function.func_code, DummyClass.method.func_code])