MCPcopy
hub / github.com/python/mypy / test_crawl_namespace

Method test_crawl_namespace

mypy/test/test_find_sources.py:103–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

101 assert crawl(finder, "/a/b/c/setup.py") == ("c.setup", "/a/b")
102
103 def test_crawl_namespace(self) -> None:
104 options = Options()
105 options.namespace_packages = True
106
107 finder = SourceFinder(FakeFSCache({"/setup.py"}), options)
108 assert crawl(finder, "/setup.py") == ("setup", "/")
109
110 finder = SourceFinder(FakeFSCache({"/a/setup.py"}), options)
111 assert crawl(finder, "/a/setup.py") == ("setup", "/a")
112
113 finder = SourceFinder(FakeFSCache({"/a/b/setup.py"}), options)
114 assert crawl(finder, "/a/b/setup.py") == ("setup", "/a/b")
115
116 finder = SourceFinder(FakeFSCache({"/a/setup.py", "/a/__init__.py"}), options)
117 assert crawl(finder, "/a/setup.py") == ("a.setup", "/")
118
119 finder = SourceFinder(FakeFSCache({"/a/invalid-name/setup.py", "/a/__init__.py"}), options)
120 assert crawl(finder, "/a/invalid-name/setup.py") == ("setup", "/a/invalid-name")
121
122 finder = SourceFinder(FakeFSCache({"/a/b/setup.py", "/a/__init__.py"}), options)
123 assert crawl(finder, "/a/b/setup.py") == ("a.b.setup", "/")
124
125 finder = SourceFinder(
126 FakeFSCache({"/a/b/c/setup.py", "/a/__init__.py", "/a/b/c/__init__.py"}), options
127 )
128 assert crawl(finder, "/a/b/c/setup.py") == ("a.b.c.setup", "/")
129
130 def test_crawl_namespace_explicit_base(self) -> None:
131 options = Options()

Callers

nothing calls this directly

Calls 4

OptionsClass · 0.90
SourceFinderClass · 0.90
FakeFSCacheClass · 0.85
crawlFunction · 0.85

Tested by

no test coverage detected