From c74c81e61cf91d77674a551a178bbdfab1da2d39 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 27 May 2020 20:54:32 -0700 Subject: [PATCH 1/2] remove open() pythoneval test python/typeshed#3371 causes this to produce a different error message. open() with no arguments doesn't seem like an important use case, so testing for it explicitly in pythoneval isn't all that useful. --- test-data/unit/pythoneval.test | 3 --- 1 file changed, 3 deletions(-) diff --git a/test-data/unit/pythoneval.test b/test-data/unit/pythoneval.test index 6a76b3941a5d..5368a29cbef4 100644 --- a/test-data/unit/pythoneval.test +++ b/test-data/unit/pythoneval.test @@ -287,14 +287,11 @@ _program.py:3: note: Revealed type is 'typing.BinaryIO' _program.py:5: note: Revealed type is 'typing.IO[Any]' [case testOpenReturnTypeInferenceSpecialCases] -reveal_type(open()) reveal_type(open(mode='rb', file='x')) reveal_type(open(file='x', mode='rb')) mode = 'rb' reveal_type(open(mode=mode, file='r')) [out] -_testOpenReturnTypeInferenceSpecialCases.py:1: error: Too few arguments for "open" -_testOpenReturnTypeInferenceSpecialCases.py:1: note: Revealed type is 'typing.TextIO' _testOpenReturnTypeInferenceSpecialCases.py:2: note: Revealed type is 'typing.BinaryIO' _testOpenReturnTypeInferenceSpecialCases.py:3: note: Revealed type is 'typing.BinaryIO' _testOpenReturnTypeInferenceSpecialCases.py:5: note: Revealed type is 'typing.IO[Any]' From 9a0589c7eca8340c7c2c39335cdee90f4661aae3 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 27 May 2020 21:28:26 -0700 Subject: [PATCH 2/2] fix line numbers --- test-data/unit/pythoneval.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-data/unit/pythoneval.test b/test-data/unit/pythoneval.test index 5368a29cbef4..a37cf2959d02 100644 --- a/test-data/unit/pythoneval.test +++ b/test-data/unit/pythoneval.test @@ -292,9 +292,9 @@ reveal_type(open(file='x', mode='rb')) mode = 'rb' reveal_type(open(mode=mode, file='r')) [out] +_testOpenReturnTypeInferenceSpecialCases.py:1: note: Revealed type is 'typing.BinaryIO' _testOpenReturnTypeInferenceSpecialCases.py:2: note: Revealed type is 'typing.BinaryIO' -_testOpenReturnTypeInferenceSpecialCases.py:3: note: Revealed type is 'typing.BinaryIO' -_testOpenReturnTypeInferenceSpecialCases.py:5: note: Revealed type is 'typing.IO[Any]' +_testOpenReturnTypeInferenceSpecialCases.py:4: note: Revealed type is 'typing.IO[Any]' [case testPathOpenReturnTypeInference] from pathlib import Path