mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Python: Add testcases for py/import-own-module
You can try out: python2 -c "import pkg_ok; print(pkg_ok.foo1); print(pkg_ok.foo2); print(pkg_ok.foo3); print(pkg_ok.foo4); print(pkg_ok.foo5); print(pkg_ok.Foo3); print(pkg_ok.Foo5); print(pkg_ok.pkg_ok)" python3 -c "import pkg_ok; print(pkg_ok.foo1); print(pkg_ok.foo2); print(pkg_ok.foo3); print(pkg_ok.foo4); print(pkg_ok.foo5); print(pkg_ok.Foo3); print(pkg_ok.Foo5); print(pkg_ok.pkg_ok)"
This commit is contained in:
@@ -1 +1,2 @@
|
||||
| imports_test.py:4:1:4:19 | Import | Module 'test_module2' is imported with both 'import' and 'import from' |
|
||||
| pkg_notok/__init__.py:4:1:4:16 | Import | Module 'pkg_notok' is imported with both 'import' and 'import from' |
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
| imports_test.py:8:1:8:19 | Import | The module 'imports_test' imports itself. |
|
||||
| pkg_notok/__init__.py:4:1:4:16 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_notok/__init__.py:6:1:6:25 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_notok/__init__.py:7:1:7:37 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_ok/__init__.py:2:1:2:18 | Import | The module 'pkg_ok' imports itself. |
|
||||
| pkg_ok/__init__.py:4:1:4:23 | Import | The module 'pkg_ok' imports itself. |
|
||||
| pkg_ok/__init__.py:5:1:5:28 | Import | The module 'pkg_ok' imports itself. |
|
||||
| pkg_ok/__init__.py:7:1:7:18 | Import | The module 'pkg_ok' imports itself. |
|
||||
| pkg_ok/__init__.py:8:1:8:22 | Import | The module 'pkg_ok' imports itself. |
|
||||
|
||||
@@ -7,3 +7,5 @@ from test_module2 import func
|
||||
#Module imports itself
|
||||
import imports_test
|
||||
|
||||
import pkg_ok
|
||||
import pkg_notok
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Foo(object):
|
||||
pass
|
||||
|
||||
import pkg_notok
|
||||
|
||||
from pkg_notok import Foo
|
||||
from pkg_notok import Foo as NotOkFoo
|
||||
from pkg_notok import * # TODO: TN
|
||||
@@ -0,0 +1,8 @@
|
||||
# This import makes `pkg_ok` available, but also `foo1` (surprising as it may be)
|
||||
import pkg_ok.foo1 # TODO: FP
|
||||
|
||||
from pkg_ok import foo2 # TODO: FP
|
||||
from pkg_ok.foo3 import Foo3 # TODO: FP
|
||||
|
||||
from . import foo4 # TODO: FP
|
||||
from .foo5 import Foo5 # TODO: FP
|
||||
@@ -0,0 +1,2 @@
|
||||
class Foo1():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
class Foo2():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
class Foo3():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
class Foo4():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
class Foo5():
|
||||
pass
|
||||
Reference in New Issue
Block a user