def test_merge_prefix(self): d = deque([b'abc', b'de', b'fghi', b'j']) merge_prefix(d, 5) self.assertEqual(d, deque([b'abcde', b'fghi', b'j'])) d = deque([b'abc', b'de', b'fghi', b'j']) merge_prefix(d, 4) self.assertEqual(d, deque([b'abcd', b'e', b'fghi', b'j'])) merge_prefix(d, 7) self.assertEqual(d, deque([b'abcdefg', b'hi', b'j'])) merge_prefix(d, 3) self.assertEqual(d, deque([b'abc', b'defg', b'hi', b'j'])) merge_prefix(d, 100) self.assertEqual(d, deque([b'abcdefghij']))