mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Try to get get the tests for Python 3.9 passing, fixes #1608
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
dist: xenial
|
dist: xenial
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
|
- 3.9-dev
|
||||||
- 3.8
|
- 3.8
|
||||||
- 3.7
|
- 3.7
|
||||||
- 3.6
|
- 3.6
|
||||||
|
|||||||
@@ -134,8 +134,19 @@ def test_infer_on_non_name(Script):
|
|||||||
assert Script('import x').infer(column=0) == []
|
assert Script('import x').infer(column=0) == []
|
||||||
|
|
||||||
|
|
||||||
def test_infer_on_generator(Script):
|
def test_infer_on_generator(Script, environment):
|
||||||
def_, = Script('def x(): yield 1\ny=x()\ny').infer()
|
script = Script('def x(): yield 1\ny=x()\ny')
|
||||||
|
def_, = script.infer()
|
||||||
|
if environment.version_info >= (3, 9):
|
||||||
|
# The Generator in Python 3.9 is properly inferred, however once it is
|
||||||
|
# converted from stub to Python, the definition is
|
||||||
|
# Generator = _SpecialGenericAlias(collections.abc.Generator, 3)
|
||||||
|
# This is pretty normal for most typing types, like Sequence, List,
|
||||||
|
# etc.
|
||||||
|
assert def_.name == '_SpecialGenericAlias'
|
||||||
|
else:
|
||||||
|
assert def_.name == 'Generator'
|
||||||
|
def_, = script.infer(only_stubs=True)
|
||||||
assert def_.name == 'Generator'
|
assert def_.name == 'Generator'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user