File tree 2 files changed +7
-7
lines changed 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 5
5
for file format description
6
6
7
7
Version 1.1 will be implemented as it is most commonly used
8
- """ # noqa
8
+ """
9
9
10
- import io
11
10
import logging
12
11
import os
13
12
from datetime import datetime , timedelta , timezone
@@ -274,7 +273,7 @@ def __init__(
274
273
super ().__init__ (file , mode = "w" )
275
274
self .channel = channel
276
275
277
- if isinstance (self .file , io . TextIOWrapper ):
276
+ if hasattr (self .file , "reconfigure" ):
278
277
self .file .reconfigure (newline = "\r \n " )
279
278
else :
280
279
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):
934
934
self .assertMessagesEqual (actual , expected_messages )
935
935
936
936
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 ())
941
942
942
943
943
944
class TestTrcFileFormatV1_0 (TestTrcFileFormatBase ):
You can’t perform that action at this time.
0 commit comments