Skip to content

plugins: delete open plugin #9275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
hauntsaninja committed Sep 28, 2020
commit 6ac771c73eeea78ed76efec5653d8953e88f0459
4 changes: 2 additions & 2 deletions test-data/stdlib-samples/3.2/test/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def test_encode_file(self) -> None:
output = self.get_output('-e', support.TESTFN)
self.assertEqual(output.rstrip(), b'Yf9iCg==')

with open(support.TESTFN, 'rb') as fp:
output = self.get_output('-e', stdin=fp)
with open(support.TESTFN, 'rb') as fp2:
output = self.get_output('-e', stdin=fp2)
self.assertEqual(output.rstrip(), b'Yf9iCg==')

def test_decode(self) -> None:
Expand Down
35 changes: 15 additions & 20 deletions test-data/stdlib-samples/3.2/test/test_genericpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,21 @@ def test_getsize(self) -> None:
support.unlink(support.TESTFN)

def test_time(self) -> None:
f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
f = open(support.TESTFN, "ab")
f.write(b"bar")
f.close()
f = open(support.TESTFN, "rb")
d = f.read()
f.close()
self.assertEqual(d, b"foobar")

self.assertLessEqual(
self.pathmodule.getctime(support.TESTFN),
self.pathmodule.getmtime(support.TESTFN)
)
finally:
if not f.closed:
f.close()
support.unlink(support.TESTFN)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to drop the finally clause with unlink?

Copy link
Collaborator Author

@hauntsaninja hauntsaninja Aug 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't be, if this code were ever executed! We've talked about entirely getting rid of the stdlib samples before (e.g., in #8838), so I didn't try very hard to preserve them.

f1 = open(support.TESTFN, "wb")
f1.write(b"foo")
f1.close()
f2 = open(support.TESTFN, "ab")
f2.write(b"bar")
f2.close()
f3 = open(support.TESTFN, "rb")
d = f3.read()
f3.close()
self.assertEqual(d, b"foobar")

self.assertLessEqual(
self.pathmodule.getctime(support.TESTFN),
self.pathmodule.getmtime(support.TESTFN)
)

def test_exists(self) -> None:
self.assertIs(self.pathmodule.exists(support.TESTFN), False)
Expand Down
14 changes: 7 additions & 7 deletions test-data/unit/pythoneval.test
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ f.write('x')
f.write(b'x')
f.foobar()
[out]
_program.py:3: error: Argument 1 to "write" of "IO" has incompatible type "bytes"; expected "str"
_program.py:4: error: "TextIO" has no attribute "foobar"
_program.py:3: error: Argument 1 to "write" of "TextIOBase" has incompatible type "bytes"; expected "str"
_program.py:4: error: "TextIOWrapper" has no attribute "foobar"

[case testOpenReturnTypeInference]
reveal_type(open('x'))
Expand All @@ -281,9 +281,9 @@ reveal_type(open('x', 'rb'))
mode = 'rb'
reveal_type(open('x', mode))
[out]
_program.py:1: note: Revealed type is 'typing.TextIO'
_program.py:2: note: Revealed type is 'typing.TextIO'
_program.py:3: note: Revealed type is 'typing.BinaryIO'
_program.py:1: note: Revealed type is 'io.TextIOWrapper'
_program.py:2: note: Revealed type is 'io.TextIOWrapper'
_program.py:3: note: Revealed type is 'io.BufferedReader'
_program.py:5: note: Revealed type is 'typing.IO[Any]'

[case testOpenReturnTypeInferenceSpecialCases]
Expand All @@ -292,8 +292,8 @@ 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:1: note: Revealed type is 'io.BufferedReader'
_testOpenReturnTypeInferenceSpecialCases.py:2: note: Revealed type is 'io.BufferedReader'
_testOpenReturnTypeInferenceSpecialCases.py:4: note: Revealed type is 'typing.IO[Any]'

[case testPathOpenReturnTypeInference]
Expand Down