@@ -141,15 +141,14 @@ def price_account_bytes():
141
141
142
142
143
143
@pytest .fixture
144
- def price_account_key ():
145
- return SolanaPublicKey ("5ALDzwcRJfSyGdGyhP3kP628aqBNHZzLuVww7o9kdspe" )
146
-
147
-
148
- def test_price_account (price_account_bytes , price_account_key , solana_client ):
149
- price_account = PythPriceAccount (
150
- key = price_account_key ,
144
+ def price_account (solana_client ):
145
+ return PythPriceAccount (
146
+ key = SolanaPublicKey ("5ALDzwcRJfSyGdGyhP3kP628aqBNHZzLuVww7o9kdspe" ),
151
147
solana = solana_client ,
152
148
)
149
+
150
+
151
+ def test_price_account_update_from (price_account_bytes , price_account ):
153
152
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = 0 )
154
153
155
154
assert price_account .price_type == PythPriceType .PRICE
@@ -171,8 +170,6 @@ def test_price_account(price_account_bytes, price_account_key, solana_client):
171
170
"price" : 707.125 ,
172
171
"confidence_interval" : 0.366305 ,
173
172
}
174
- assert price_account .min_publishers == 0
175
-
176
173
# Only assert the first element of the 19 price components
177
174
assert dict (price_account .price_components [0 ]) == {
178
175
"publisher_key" : SolanaPublicKey (
@@ -198,13 +195,10 @@ def test_price_account(price_account_bytes, price_account_key, solana_client):
198
195
},
199
196
"exponent" : - 8 ,
200
197
}
198
+ assert price_account .min_publishers == 0
201
199
202
200
203
- def test_price_account_str (price_account_bytes , price_account_key , solana_client ):
204
- price_account = PythPriceAccount (
205
- key = price_account_key ,
206
- solana = solana_client ,
207
- )
201
+ def test_price_account_str (price_account_bytes , price_account , solana_client ):
208
202
expected_empty = "PythPriceAccount PythPriceType.UNKNOWN (5ALDzwcRJfSyGdGyhP3kP628aqBNHZzLuVww7o9kdspe)"
209
203
assert str (price_account ) == expected_empty
210
204
@@ -223,13 +217,15 @@ def test_price_account_str(price_account_bytes, price_account_key, solana_client
223
217
assert str (price_account ) == expected_with_product
224
218
225
219
226
- def test_price_account_agregate_properties (
227
- price_account_bytes , price_account_key , solana_client
220
+ def test_price_account_agregate_conf_interval (
221
+ price_account_bytes , price_account ,
228
222
):
229
- price_account = PythPriceAccount (
230
- key = price_account_key ,
231
- solana = solana_client ,
232
- )
233
223
price_account .update_from (buffer = price_account_bytes , version = 2 , offset = 0 )
234
- assert price_account .aggregate_price == 707.125
235
224
assert price_account .aggregate_price_confidence_interval == 0.366305
225
+
226
+
227
+ def test_price_account_agregate_price (
228
+ price_account_bytes , price_account ,
229
+ ):
230
+ price_account .update_from (buffer = price_account_bytes , version = 2 , offset = 0 )
231
+ assert price_account .aggregate_price == 707.125
0 commit comments