@@ -20,6 +20,21 @@ def price_info_trading_bytes():
20
20
return base64 .b64decode (b'EKH74A0AAABkU5ECAAAAAAEAAAAAAAAAQchHBgAAAAA=' )
21
21
22
22
23
+ @pytest .fixture
24
+ def price_info_ignored ():
25
+ return PythPriceInfo (
26
+ raw_price = 59609162000 ,
27
+ raw_confidence_interval = 43078500 ,
28
+ price_status = PythPriceStatus .IGNORED ,
29
+ pub_slot = 105367617 ,
30
+ exponent = - 8 ,
31
+ )
32
+
33
+
34
+ @pytest .fixture
35
+ def price_info_ignored_bytes ():
36
+ return base64 .b64decode (b'EKH74A0AAABkU5ECAAAAAAQAAAAAAAAAQchHBgAAAAA=' )
37
+
23
38
@pytest .mark .parametrize (
24
39
"raw_price,raw_confidence_interval,price_status,pub_slot,exponent,price,confidence_interval" ,
25
40
[
@@ -88,7 +103,7 @@ def test_price_info_iter(
88
103
assert actual == expected
89
104
90
105
91
- def test_price_info_deserialise (price_info_trading , price_info_trading_bytes ):
106
+ def test_price_info_deserialise_trading (price_info_trading , price_info_trading_bytes ):
92
107
actual = PythPriceInfo .deserialise (
93
108
buffer = price_info_trading_bytes ,
94
109
offset = 0 ,
@@ -97,6 +112,15 @@ def test_price_info_deserialise(price_info_trading, price_info_trading_bytes):
97
112
assert asdict (actual ) == asdict (price_info_trading )
98
113
99
114
115
+ def test_price_info_deserialise_ignored (price_info_ignored , price_info_ignored_bytes ):
116
+ actual = PythPriceInfo .deserialise (
117
+ buffer = price_info_ignored_bytes ,
118
+ offset = 0 ,
119
+ exponent = price_info_ignored .exponent ,
120
+ )
121
+ assert asdict (actual ) == asdict (price_info_ignored )
122
+
123
+
100
124
def test_price_info_str (price_info_trading ):
101
125
expected = "PythPriceInfo status PythPriceStatus.TRADING price 596.09162"
102
126
assert str (price_info_trading ) == expected
0 commit comments