def test_parsing(self): ns = netstruct.NetStruct(b"ih$5b") self.assertEqual(len(ns._pairs), 2) self.assertEqual(ns.minimum_size, 11) self.assertEqual(ns.initial_size, 6) self.assertEqual(ns.count, 7)
def on_connect(self): self.read_delimiter = netstruct.NetStruct("ih$5b")
def test_quantity_string(self): with self.assertRaises(netstruct.error): netstruct.NetStruct(b"i5$")
def test_immediate_string(self): with self.assertRaises(netstruct.error): netstruct.NetStruct(b"$")
def test_adjacent_strings(self): with self.assertRaises(netstruct.error): netstruct.NetStruct(b"b$$")
def test_other_type(self): with self.assertRaises(TypeError): netstruct.NetStruct(42)
def test_unicode(self): with self.assertRaises(TypeError): netstruct.NetStruct("ib")
def test_empty(self): netstruct.NetStruct(b"")