11"""Tests for entity query functionality."""
22
3- from unittest import result
43import uuid
54
65import pytest
@@ -30,7 +29,9 @@ def test_query_entities_accepts_query_only(self, arkiv_client_http: Arkiv) -> No
3029 """Test that query_entities accepts query without cursor."""
3130 # Should not raise ValueError for missing cursor
3231 # Query will execute (returns empty result since no matching entities exist)
33- result = arkiv_client_http .arkiv .query_entities (query = 'owner = "0x0000000000000000000000000000000000000000"' )
32+ result = arkiv_client_http .arkiv .query_entities (
33+ query = 'owner = "0x0000000000000000000000000000000000000000"'
34+ )
3435 assert not result # check for falsy result
3536 assert len (result ) == 0 # No entities match this owner
3637
@@ -41,7 +42,9 @@ def test_query_entities_accepts_cursor_only(self, arkiv_client_http: Arkiv) -> N
4142
4243 # Should not raise ValueError for missing query
4344 # Will raise NotImplementedError since cursor-based pagination is not yet implemented
44- with pytest .raises (NotImplementedError , match = "not yet implemented for cursors" ):
45+ with pytest .raises (
46+ NotImplementedError , match = "not yet implemented for cursors"
47+ ):
4548 arkiv_client_http .arkiv .query_entities (cursor = cursor )
4649
4750 def test_query_entities_both_query_and_cursor_not_allowed (
@@ -52,7 +55,10 @@ def test_query_entities_both_query_and_cursor_not_allowed(
5255
5356 # Should raise ValueError when both are provided
5457 with pytest .raises (ValueError , match = "Cannot provide both query and cursor" ):
55- arkiv_client_http .arkiv .query_entities (query = 'owner = "0x0000000000000000000000000000000000000000"' , cursor = cursor )
58+ arkiv_client_http .arkiv .query_entities (
59+ query = 'owner = "0x0000000000000000000000000000000000000000"' ,
60+ cursor = cursor ,
61+ )
5662
5763 def test_query_entities_with_all_parameters (self , arkiv_client_http : Arkiv ) -> None :
5864 """Test that query_entities accepts all parameters."""
@@ -73,7 +79,9 @@ def test_query_entities_with_cursor_and_parameters(
7379
7480 # Should not raise ValueError
7581 # Will raise NotImplementedError since cursor-based pagination is not yet implemented
76- with pytest .raises (NotImplementedError , match = "not yet implemented for cursors" ):
82+ with pytest .raises (
83+ NotImplementedError , match = "not yet implemented for cursors"
84+ ):
7785 arkiv_client_http .arkiv .query_entities (
7886 cursor = cursor ,
7987 limit = 100 , # Ignored when cursor is provided
@@ -106,12 +114,12 @@ def test_query_entities_by_annotation(self, arkiv_client_http: Arkiv) -> None:
106114
107115 # Verify result basics
108116 assert result # Check __bool__()
117+ assert result .block_number > 0
109118 assert result .has_more () is False
110119 assert result .next_cursor is None # only 3 results, no pagination needed
111120
112121 # Verify we got back all 3 entities
113122 assert len (result .entities ) == 3
114- assert result .block_number > 0
115123
116124 # Verify the entity keys match (order may differ)
117125 result_keys = {entity .entity_key for entity in result .entities }
0 commit comments