Message396469
I'd like to write this test case:
with patch('builtins.open') as pyopen:
mock_open(pyopen, read_data="foo")
run()
pyopen.assert_has_calls([call("filename", "wt"),
call().write("gazonk"),
call().close()])
and I shouldn't have to care if the code is written like this:
def run():
f = open("filename", "wt")
try:
write("gazonk")
finally:
f.close()
or like this:
def run():
with open("filename", "wt") as f:
write("gazonk") |
|
Date |
User |
Action |
Args |
2021-06-24 11:08:55 | CendioOssman | set | recipients:
+ CendioOssman |
2021-06-24 11:08:55 | CendioOssman | set | messageid: <1624532935.8.0.760752273219.issue44503@roundup.psfhosted.org> |
2021-06-24 11:08:55 | CendioOssman | link | issue44503 messages |
2021-06-24 11:08:55 | CendioOssman | create | |
|