Skip to content

Commit

Permalink
tox style
Browse files Browse the repository at this point in the history
  • Loading branch information
akremstudy committed Feb 20, 2024
1 parent da76702 commit 807d622
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/queries/test_string_query.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
from telliot_feeds.queries.string_query import StringQuery
from eth_abi import encode



def test_string_query_data():

q = StringQuery("What is the meaning of life")

expected_value = "Please refer to: https://en.wikipedia.org/wiki/Meaning_of_life"
expected_value_encoded = "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003e506c6561736520726566657220746f3a2068747470733a2f2f656e2e77696b6970656469612e6f72672f77696b692f4d65616e696e675f6f665f6c6966650000"
expected_value_encoded = "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003e506c6561736520726566657220746f3a2068747470733a2f2f656e2e77696b6970656469612e6f72672f77696b692f4d65616e696e675f6f665f6c6966650000" # noqa: E501
response_encoded = q.value_type.encode(expected_value)
response_decoded = q.value_type.decode(bytes.fromhex(expected_value_encoded))[0]

assert response_encoded.hex() == expected_value_encoded
assert response_decoded == expected_value


expected_query_data = "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b537472696e67517565727900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b5768617420697320746865206d65616e696e67206f66206c6966650000000000"
expected_query_data = "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b537472696e67517565727900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b5768617420697320746865206d65616e696e67206f66206c6966650000000000" # noqa: E501
expected_query_id = "5ad9f178a75e92c8beb8e1e6e2956377ad50f2288c9a82ccfdc69a18651deff5"
assert q.query_data.hex() == expected_query_data
assert q.query_id.hex() == expected_query_id
assert q.query_id.hex() == expected_query_id

0 comments on commit 807d622

Please sign in to comment.