From 2311398f99759aa22b225d3f5bc4a901ceba50c3 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 9 Mar 2021 21:06:36 +0100 Subject: Migrate func_w0405.py to new functional tests --- tests/functional/r/reimport.py | 31 +++++++++++++++++++++++++++++++ tests/functional/r/reimport.txt | 4 ++++ tests/functional/r/reimported.py | 4 ++-- tests/input/func_w0405.py | 31 ------------------------------- tests/messages/func_w0405.txt | 4 ---- tests/test_func.py | 2 +- 6 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 tests/functional/r/reimport.py create mode 100644 tests/functional/r/reimport.txt delete mode 100644 tests/input/func_w0405.py delete mode 100644 tests/messages/func_w0405.txt diff --git a/tests/functional/r/reimport.py b/tests/functional/r/reimport.py new file mode 100644 index 000000000..defe51959 --- /dev/null +++ b/tests/functional/r/reimport.py @@ -0,0 +1,31 @@ +"""check reimport +""" +from __future__ import absolute_import, print_function + +# pylint: disable=using-constant-test,ungrouped-imports,wrong-import-position,import-outside-toplevel +import os +from os.path import join, exists +import os # [reimported] +import re as _re + +__revision__ = 0 +_re.match('yo', '.*') + +if __revision__: + print(os) + from os.path import exists # [reimported] + print(join, exists) + +def func(yooo): + """reimport in different scope""" + import os as ass # [reimported] + ass.remove(yooo) + import re # [reimported] + re.compile('.*') + +if 1: # pylint: disable=using-constant-test + import sys + print(sys.modules) +else: + print('bla') + import sys diff --git a/tests/functional/r/reimport.txt b/tests/functional/r/reimport.txt new file mode 100644 index 000000000..c57d14817 --- /dev/null +++ b/tests/functional/r/reimport.txt @@ -0,0 +1,4 @@ +reimported:8:0::Reimport 'os' (imported line 6) +reimported:16:4::Reimport 'exists' (imported line 7) +reimported:21:4:func:Reimport 'os' (imported line 6) +reimported:23:4:func:Reimport 're' (imported line 9) diff --git a/tests/functional/r/reimported.py b/tests/functional/r/reimported.py index 3fe8c901a..03b07c4d6 100644 --- a/tests/functional/r/reimported.py +++ b/tests/functional/r/reimported.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring,unused-import,import-error, wildcard-import,unused-wildcard-import,redefined-builtin,no-name-in-module,ungrouped-imports,wrong-import-order -from time import sleep, sleep # [reimported] -from lala import missing, missing # [reimported] +from time import sleep, sleep # [reimported] +from lala import missing, missing # [reimported] import missing1 import missing1 # [reimported] diff --git a/tests/input/func_w0405.py b/tests/input/func_w0405.py deleted file mode 100644 index 95c4d134f..000000000 --- a/tests/input/func_w0405.py +++ /dev/null @@ -1,31 +0,0 @@ -"""check reimport -""" -from __future__ import absolute_import, print_function - -# pylint: disable=using-constant-test,ungrouped-imports,wrong-import-position,import-outside-toplevel -import os -from os.path import join, exists -import os -import re as _re - -__revision__ = 0 -_re.match('yo', '.*') - -if __revision__: - print(os) - from os.path import exists - print(join, exists) - -def func(yooo): - """reimport in different scope""" - import os as ass - ass.remove(yooo) - import re - re.compile('.*') - -if 1: # pylint: disable=using-constant-test - import sys - print(sys.modules) -else: - print('bla') - import sys diff --git a/tests/messages/func_w0405.txt b/tests/messages/func_w0405.txt deleted file mode 100644 index 072b15547..000000000 --- a/tests/messages/func_w0405.txt +++ /dev/null @@ -1,4 +0,0 @@ -W: 8: Reimport 'os' (imported line 6) -W: 16: Reimport 'exists' (imported line 7) -W: 21:func: Reimport 'os' (imported line 6) -W: 23:func: Reimport 're' (imported line 9) diff --git a/tests/test_func.py b/tests/test_func.py index ebcd2b5db..24c8ae6b2 100644 --- a/tests/test_func.py +++ b/tests/test_func.py @@ -120,7 +120,7 @@ def gen_tests(filter_rgx): tests.append((module_file, messages_file, dependencies)) if UPDATE_FILE.exists(): return tests - assert len(tests) < 16, "Please do not add new test cases here." + assert len(tests) < 15, "Please do not add new test cases here." return tests -- cgit v1.2.1