Skip to content

Commit 6438d27

Browse files
committed
Add test for #847
1 parent 66d9840 commit 6438d27

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

bpython/test/test_importcompletion.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,32 @@ def test_simple_symbolic_link_loop(self):
199199
self.assertFalse(filepaths)
200200

201201

202+
class TestBugReports(unittest.TestCase):
203+
def test_issue_847(self):
204+
with tempfile.TemporaryDirectory() as import_test_folder:
205+
# ./xyzzy
206+
# ./xyzzy/__init__.py
207+
# ./xyzzy/plugh
208+
# ./xyzzy/plugh/__init__.py
209+
# ./xyzzy/plugh/bar.py
210+
# ./xyzzy/plugh/foo.py
211+
212+
base_path = Path(import_test_folder)
213+
(base_path / "xyzzy" / "plugh").mkdir(parents=True)
214+
(base_path / "xyzzy" / "__init__.py").touch()
215+
(base_path / "xyzzy" / "plugh" / "__init__.py").touch()
216+
(base_path / "xyzzy" / "plugh" / "bar.py").touch()
217+
(base_path / "xyzzy" / "plugh" / "foo.py").touch()
218+
219+
module_gatherer = ModuleGatherer([base_path.absolute()])
220+
while module_gatherer.find_coroutine():
221+
pass
222+
223+
self.assertSetEqual(
224+
module_gatherer.complete(17, "from xyzzy.plugh."),
225+
{"xyzzy.plugh.bar", "xyzzy.plugh.foo"},
226+
)
227+
228+
202229
if __name__ == "__main__":
203230
unittest.main()

0 commit comments

Comments
 (0)