def test_insert_with_non_string(self): bytes_list = BytesList() with self.assertRaises(TypeError): bytes_list.insert(0, NON_STRING_VALUE)
def test_insert_with_byte_string(self): bytes_list = BytesList() with self.assertRaises(TypeError): bytes_list.insert(0, u"some string")
def test_insert(self): bytes_list = BytesList() bytes_list.insert(0, b"some string") self.assertEqual(bytes_list, [b"some string"])