Skip to content

Commit 59fc8c9

Browse files
committed
fix test
1 parent 31dd13a commit 59fc8c9

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/test_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ def test_NWK():
7979

8080
def test_sqlite3_converter():
8181
ieee = t.EUI64.deserialize(b'\x12\x34\x56\x78\x9a\xbc\xde\xf0')[0]
82-
s = repr(ieee).encode()
83-
ieee2 = t.EUI64([t.uint8_t(p, base=16) for p in s.split(b':')[::-1]])
82+
s = t.adapt_ieee(ieee).encode()
83+
ieee2 = t.convert_ieee(s)
8484
assert ieee == ieee2

zigpy_zigate/types.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import zigpy.appdb # noqa
66

77

8+
def adapt_ieee(eui64):
9+
return repr(eui64)
10+
11+
12+
def convert_ieee(s):
13+
ieee = [uint8_t(p, base=16) for p in s.split(b':')[::-1]]
14+
return EUI64(ieee)
15+
16+
817
def _sqlite_adapters():
9-
def adapt_ieee(eui64):
10-
return repr(eui64)
1118
sqlite3.register_adapter(EUI64, adapt_ieee)
12-
13-
def convert_ieee(s):
14-
ieee = [uint8_t(p, base=16) for p in s.split(b':')[::-1]]
15-
return EUI64(ieee)
1619
sqlite3.register_converter("ieee", convert_ieee)
1720

1821

0 commit comments

Comments
 (0)