Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / telemetry / third_party / modulegraph / modulegraph_tests / test_basic.py
blob387fde9f736a26ed647f0cc791039f90e3eb3de3
1 import unittest
3 import os, shutil
5 from modulegraph import modulegraph
7 class DummyModule(object):
8 packagepath = None
9 def __init__(self, ppath):
10 self.packagepath = ppath
12 class FindAllSubmodulesTestCase(unittest.TestCase):
13 def testNone(self):
14 mg = modulegraph.ModuleGraph()
15 # empty packagepath
16 m = DummyModule(None)
17 sub_ms = []
18 for sm in mg._find_all_submodules(m):
19 sub_ms.append(sm)
20 self.assertEqual(sub_ms, [])
22 def testSimple(self):
23 mg = modulegraph.ModuleGraph()
24 # a string does not break anything although it is split into its characters
25 # BUG: "/hi/there" will read "/"
26 m = DummyModule("xyz")
27 sub_ms = []
28 for sm in mg._find_all_submodules(m):
29 sub_ms.append(sm)
30 self.assertEqual(sub_ms, [])
32 def testSlashes(self):
33 # a string does not break anything although it is split into its characters
34 # BUG: "/xyz" will read "/" so this one already triggers missing itertools
35 mg = modulegraph.ModuleGraph()
36 m = DummyModule("/xyz")
37 sub_ms = []
38 for sm in mg._find_all_submodules(m):
39 sub_ms.append(sm)
40 self.assertEqual(sub_ms, [])
42 if __name__ == '__main__':
43 unittest.main()