Exemplo n.º 1
0
 def test_read_blocks_doctest(self):
     blocks = [(0, b'abc'), (16, b'def')]
     stream = io.StringIO()
     MotorolaRecord.write_blocks(stream, blocks)
     stream.seek(0, io.SEEK_SET)
     ans_out = MotorolaRecord.read_blocks(stream)
     ans_ref = blocks
     assert ans_out == ans_ref
Exemplo n.º 2
0
 def test_write_blocks_doctest(self):
     blocks = [(0, b'abc'), (16, b'def')]
     stream = io.StringIO()
     MotorolaRecord.write_blocks(stream, blocks)
     ans_out = stream.getvalue()
     ans_ref = ('S0030000FC\n'
                'S1060000616263D3\n'
                'S1060010646566BA\n'
                'S5030002FA\n'
                'S9030000FC\n')
     assert ans_out == ans_ref
Exemplo n.º 3
0
 def test_read_records_doctest(self):
     blocks = [(0, b'abc'), (16, b'def')]
     stream = io.StringIO()
     MotorolaRecord.write_blocks(stream, blocks)
     stream.seek(0, io.SEEK_SET)
     records = MotorolaRecord.read_records(stream)
     ans_out = list(map(str, records))
     ans_ref = [
         'S0030000FC', 'S1060000616263D3', 'S1060010646566BA', 'S5030002FA',
         'S9030000FC'
     ]
     assert ans_out == ans_ref