| Conditions | 4 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Tests for the starstruct class""" |
||
| 19 | def test_escape_sequence_items(self): |
||
| 20 | TestStruct = Message('TestStruct', [ |
||
| 21 | ('escaped_data', self.Repeated, { |
||
| 22 | 'escape': { |
||
| 23 | 'start': b'\xff\x00\xff\x11', |
||
| 24 | 'separator': b'\x12\x12', |
||
| 25 | 'end': b'\x11\xff\x00\xff', |
||
| 26 | }, |
||
| 27 | }), |
||
| 28 | ]) |
||
| 29 | |||
| 30 | test_data = { |
||
| 31 | 'escaped_data': [ |
||
| 32 | {'x': 7, 'y': 9, 'z': 13}, |
||
| 33 | {'x': 2, 'y': 8, 'z': 27}, |
||
| 34 | {'x': 6, 'y': 7, 'z': 11}, |
||
| 35 | ], |
||
| 36 | } |
||
| 37 | |||
| 38 | made = TestStruct.make(test_data) |
||
| 39 | assert made.escaped_data[0].x == 7 |
||
| 40 | assert made.escaped_data[0].y == 9 |
||
| 41 | |||
| 42 | packed = TestStruct.pack(test_data) |
||
| 43 | |||
| 44 | unpacked = TestStruct.unpack(packed) |
||
| 45 | assert unpacked == made |
||
| 46 |