File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 55for file format description
66
77Version 1.1 will be implemented as it is most commonly used
8- """ # noqa
8+ """
99
10- import io
1110import logging
1211import os
1312from datetime import datetime , timedelta , timezone
@@ -274,7 +273,7 @@ def __init__(
274273 super ().__init__ (file , mode = "w" )
275274 self .channel = channel
276275
277- if isinstance (self .file , io . TextIOWrapper ):
276+ if hasattr (self .file , "reconfigure" ):
278277 self .file .reconfigure (newline = "\r \n " )
279278 else :
280279 raise TypeError ("File must be opened in text mode." )
Original file line number Diff line number Diff line change @@ -934,10 +934,11 @@ def msg_ext(timestamp):
934934 self .assertMessagesEqual (actual , expected_messages )
935935
936936 def test_not_supported_version (self ):
937- with self .assertRaises (NotImplementedError ):
938- writer = can .TRCWriter ("test.trc" )
939- writer .file_version = can .TRCFileVersion .UNKNOWN
940- writer .on_message_received (can .Message ())
937+ with tempfile .NamedTemporaryFile (mode = "w" ) as f :
938+ with self .assertRaises (NotImplementedError ):
939+ writer = can .TRCWriter (f )
940+ writer .file_version = can .TRCFileVersion .UNKNOWN
941+ writer .on_message_received (can .Message ())
941942
942943
943944class TestTrcFileFormatV1_0 (TestTrcFileFormatBase ):
You can’t perform that action at this time.
0 commit comments