File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -392,6 +392,26 @@ def test_file_like_explicit_stop(self):
392392 def test_file_like_context_manager (self ):
393393 pass
394394
395+ def test_read_all (self ):
396+ """
397+ testing :meth:`can.SqliteReader.read_all` with context manager and path-like object
398+ """
399+ # create writer
400+ print ("writing all messages/comments" )
401+ with self .writer_constructor (self .test_file_name ) as writer :
402+ self ._write_all (writer )
403+
404+ # read all written messages
405+ print ("reading all messages" )
406+ with self .reader_constructor (self .test_file_name ) as reader :
407+ read_messages = reader .read_all ()
408+
409+ # check if at least the number of messages matches;
410+ self .assertEqual (len (read_messages ), len (self .original_messages ),
411+ "the number of written messages does not match the number of read messages" )
412+
413+ self .assertMessagesEqual (read_messages )
414+
395415
396416class TestPrinter (unittest .TestCase ):
397417 """Tests that can.Printer does not crash"""
You can’t perform that action at this time.
0 commit comments