@@ -17,8 +17,8 @@ class TestList(t.LVList, item_type=t.uint8_t, length_type=t.uint8_t):
1717 assert t .serialize_list ([]) == b""
1818
1919
20- def test_enum_uint ():
21- class TestEnum (t .enum_flag_uint16 ):
20+ def test_enum ():
21+ class TestEnum (t .bitmap16 ):
2222 ALL = 0xFFFF
2323 CH_1 = 0x0001
2424 CH_2 = 0x0002
@@ -39,19 +39,6 @@ class TestEnum(t.enum_flag_uint16):
3939 assert TestEnum (0x8012 ).serialize () == data
4040
4141
42- def test_abstract_ints ():
43- assert issubclass (t .uint8_t , t .uint_t )
44- assert not issubclass (t .uint8_t , t .int_t )
45- assert t .int_t ._signed is True
46- assert t .uint_t ._signed is False
47-
48- with pytest .raises (TypeError ):
49- t .int_t (0 )
50-
51- with pytest .raises (TypeError ):
52- t .FixedIntType (0 )
53-
54-
5542def test_int_too_short ():
5643 with pytest .raises (ValueError ):
5744 t .uint8_t .deserialize (b"" )
@@ -132,29 +119,6 @@ class TestList(t.LVList, item_type=t.uint8_t, length_type=t.uint8_t):
132119 TestList .deserialize (b"\x04 123" )
133120
134121
135- def test_hex_repr ():
136- class NwkAsHex (t .uint16_t , hex_repr = True ):
137- pass
138-
139- nwk = NwkAsHex (0x123A )
140- assert str (nwk ) == "0x123A"
141- assert repr (nwk ) == "0x123A"
142-
143- assert str ([nwk ]) == "[0x123A]"
144- assert repr ([nwk ]) == "[0x123A]"
145-
146- # You can turn it off as well
147- class NwkWithoutHex (NwkAsHex , hex_repr = False ):
148- pass
149-
150- nwk = NwkWithoutHex (1234 )
151- assert str (nwk ) == "1234"
152- assert repr (nwk ) == "1234"
153-
154- assert str ([nwk ]) == "[1234]"
155- assert repr ([nwk ]) == "[1234]"
156-
157-
158122def test_fixed_list ():
159123 class TestList (t .FixedList , item_type = t .uint16_t , length = 3 ):
160124 pass
@@ -187,7 +151,7 @@ class TestList(t.FixedList, length=3, item_type=t.uint16_t):
187151
188152
189153def test_enum_instance_types ():
190- class TestEnum (t .enum_uint8 ):
154+ class TestEnum (t .enum8 ):
191155 Member = 0x00
192156
193157 assert TestEnum ._member_type_ is t .uint8_t
0 commit comments