def test_def_foo_no_parens(self): """Test of a def of the function of interest, but without parentheses""" line = "def foo:" self.assertFalse(_line_defines_python_function(line, "foo"))
def test_def_foobar(self): """Test of a def of a different function""" line = "def foobar():" self.assertFalse(_line_defines_python_function(line, "foo"))
def test_def_foo_indented(self): """Test of a def of the function of interest, but indented""" line = " def foo():" self.assertFalse(_line_defines_python_function(line, "foo"))
def test_import_foo_then_others(self): """Test of an import of the function of interest, along with others""" line = "from bar.baz import foo, bar" self.assertTrue(_line_defines_python_function(line, "foo"))
def test_import_others_then_foo(self): """Test of an import of the function of interest, after others""" line = "from bar.baz import bar, foo" self.assertTrue(_line_defines_python_function(line, "foo"))
def test_import_foo_space(self): """Test of an import of the function of interest, with trailing spaces""" line = "from bar.baz import foo " self.assertTrue(_line_defines_python_function(line, "foo"))
def test_def_foo_space(self): """Test of a def of the function of interest, with an extra space before the parentheses""" line = "def foo ():" self.assertTrue(_line_defines_python_function(line, "foo"))
def test_def_foo(self): """Test of a def of the function of interest""" line = "def foo():" self.assertTrue(_line_defines_python_function(line, "foo"))
def test_import_foobar(self): """Test of an import of a different function""" line = "from bar.baz import foobar" self.assertFalse(_line_defines_python_function(line, "foo"))
def test_import_foo_indented(self): """Test of an import of the function of interest, but indented""" line = " from bar.baz import foo" self.assertFalse(_line_defines_python_function(line, "foo"))