Esempio n. 1
0
 def test_find_all_include_defs_when_they_exist(self):
     all_include_defs = build_file.from_content(
         'include_defs("//foo/DEFS")').find_all_include_defs()
     self.assertEqual(["//foo/DEFS"],
                      list(
                          map(lambda include: include.get_location(),
                              all_include_defs)))
Esempio n. 2
0
 def test_find_all_include_defs_when_they_exist(self):
     all_include_defs = build_file.from_content(
         'include_defs("//foo/DEFS")').find_all_include_defs()
     self.assertEqual(["//foo/DEFS"],
                      list(
                          map(lambda include: include.get_location(),
                              all_include_defs)))
Esempio n. 3
0
    def test_find_only_include_defs_when_they_exist(self):
        content = """
include_defs("//foo/DEFS")
foo("bar")
        """
        all_include_defs = build_file.from_content(content).find_all_include_defs()
        self.assertEqual(
            ["//foo/DEFS"],
            list(map(lambda include: include.get_location(), all_include_defs)),
        )
Esempio n. 4
0
    def test_find_only_include_defs_when_they_exist(self):
        content = """
include_defs("//foo/DEFS")
foo("bar")
        """
        all_include_defs = build_file.from_content(content).find_all_include_defs()
        self.assertEqual(
            ["//foo/DEFS"],
            list(map(lambda include: include.get_location(), all_include_defs)),
        )
Esempio n. 5
0
    def test_find_function_calls_by_name(self):
        content = """
foo('bar')
bar('foo')
foo('baz')
        """
        foo_calls = build_file.from_content(
            content)._find_all_function_calls_by_name("foo")
        self.assertEqual(2, len(foo_calls))
        for call in foo_calls:
            self.assertEqual("foo", call.func.id)
Esempio n. 6
0
    def test_find_function_calls_by_name(self):
        content = """
foo('bar')
bar('foo')
foo('baz')
        """
        foo_calls = build_file.from_content(
            content)._find_all_function_calls_by_name('foo')
        self.assertEqual(2, len(foo_calls))
        for call in foo_calls:
            self.assertEqual('foo', call.func.id)
Esempio n. 7
0
    def test_find_used_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
"""
        self.assertEqual(
            ['BAR', 'bar'],
            list(
                map(lambda n: n.id,
                    build_file.from_content(content)._find_used_symbols())))
Esempio n. 8
0
    def test_find_used_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
"""
        self.assertEqual(
            ['BAR', 'bar'],
            list(
                map(lambda n: n.id,
                    build_file.from_content(content)._find_used_symbols())))
Esempio n. 9
0
    def test_find_exported_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
class Clazz:
  def foo():
    pass
"""
        self.assertEqual(
            ['foo', 'func', 'Clazz'],
            build_file.from_content(content).find_exported_symbols())
Esempio n. 10
0
    def test_find_exported_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
class Clazz:
  def foo():
    pass
"""
        self.assertEqual(
            ['foo', 'func', 'Clazz'],
            build_file.from_content(content).find_exported_symbols())
Esempio n. 11
0
 def test_find_all_include_defs_when_no_includes(self):
     self.assertEqual([], build_file.from_content("").find_all_include_defs())
Esempio n. 12
0
 def test_find_all_include_defs_when_no_includes(self):
     self.assertEqual([], build_file.from_content("").find_all_include_defs())