1
0
forked from VimPlug/jedi

Add test pyc

Should succeed for python2 and faild for python3
This commit is contained in:
ColinDuquesnoy
2014-02-18 17:36:01 +01:00
parent a75773cf9f
commit d80caa7108

38
test/test_pyc.py Normal file
View File

@@ -0,0 +1,38 @@
"""
Test completions from *.pyc files:
- generated a dummy python module
- compile the dummy module to generate a *.pyc
- delete the pure python dummy module
- try jedi on the generated *.pyc
"""
import os
import compileall
import jedi
SRC = """class Foo:
pass
class Bar:
pass
"""
def generate_pyc():
with open("dummy.py", 'w') as f:
f.write(SRC)
compileall.compile_file("dummy.py")
os.remove("dummy.py")
def test_pyc():
"""
The list of completion must be greater than 2.
"""
generate_pyc()
s = jedi.Script("import dummy; dummy.")
assert len(s.completions()) >= 2
if __name__ == "__main__":
test_pyc()