diff --git a/mathics/builtin/file_operations/file_properties.py b/mathics/builtin/file_operations/file_properties.py index d16fa5d2e..0a6dd26ff 100644 --- a/mathics/builtin/file_operations/file_properties.py +++ b/mathics/builtin/file_operations/file_properties.py @@ -241,9 +241,6 @@ class SetFileDate(Builtin): >> SetFileDate[tmpfilename, {2002, 1, 1, 0, 0, 0.}, "Access"]; - >> FileDate[tmpfilename, "Access"] - = {2002, 1, 1, 0, 0, 0.} - #> DeleteFile[tmpfilename] """ diff --git a/mathics/builtin/files_io/files.py b/mathics/builtin/files_io/files.py index dd7df7146..3746d3915 100644 --- a/mathics/builtin/files_io/files.py +++ b/mathics/builtin/files_io/files.py @@ -461,8 +461,6 @@ class OpenRead(_OpenAction): The stream must be closed after using it to release the resource: >> Close[%]; - - S> Close[OpenRead["https://raw.githubusercontent.com/Mathics3/mathics-core/master/README.rst"]]; """ summary_text = "open a file for reading" diff --git a/test/builtin/files_io/test_files.py b/test/builtin/files_io/test_files.py index c4cd469dd..a66d1d821 100644 --- a/test/builtin/files_io/test_files.py +++ b/test/builtin/files_io/test_files.py @@ -151,6 +151,12 @@ def test_close(): "OpenRead[]", "", ), + ( + 'Close[OpenRead["https://raw.githubusercontent.com/Mathics3/mathics-core/master/README.rst"]];', + None, + "Null", + "", + ), ( 'fd=OpenRead["ExampleData/EinsteinSzilLetter.txt", BinaryFormat -> True, CharacterEncoding->"UTF8"]//Head', None, @@ -318,6 +324,16 @@ def test_close(): ), ("FilePrint[pathname]", None, "Null", ""), ("DeleteFile[pathname];Clear[pathname];", None, "Null", ""), + ('tmpfilename = $TemporaryDirectory <> "/tmp0";', None, "Null", ""), + ("Close[OpenWrite[tmpfilename]];", None, "Null", ""), + ( + 'SetFileDate[tmpfilename, {2002, 1, 1, 0, 0, 0.}, "Access"];', + None, + "Null", + "", + ), + ('FileDate[tmpfilename, "Access"]', None, "{2002, 1, 1, 0, 0, 0.}", ""), + ("DeleteFile[tmpfilename]", None, "Null", ""), ], ) def test_private_doctests_files(str_expr, msgs, str_expected, fail_msg):