Try to get get the tests for Python 3.9 passing, fixes #1608

This commit is contained in:
Dave Halter
2020-06-10 09:36:39 +02:00
parent df7dd026d2
commit 3a0a484fcb
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -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'