From 0d771951ff618b8a05af2117fc7fc20c1323a5d7 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 23 Jan 2024 09:40:56 +0100 Subject: [PATCH] Add passing test for #281 --- tests/test_imports2s.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_imports2s.py b/tests/test_imports2s.py index 1160d597..bf5c0b0f 100644 --- a/tests/test_imports2s.py +++ b/tests/test_imports2s.py @@ -822,6 +822,18 @@ def test_replace_star_no_imports_found(capsys): captured = capsys.readouterr() assert 'Traceback' not in captured.err + +def test_replace_star_imports_os_issue_281(capsys): + input = PythonBlock(dedent(''' + from os import * + + getcwd() + ''').lstrip(), filename="/foo/test_replace_os_imports.py") + _ = replace_star_imports(input) + captured = capsys.readouterr() + assert 'with 18 imports' in captured.out + + def test_replace_star_imports_1(): input = PythonBlock(dedent(''' from mod1 import f1