============================= test session starts ==============================
platform linux -- Python 3.9.24, pytest-8.4.2, pluggy-1.6.0 -- /home/david/claude/brainless/python/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /home/david/claude/brainless/python
configfile: pyproject.toml
plugins: asyncio-1.2.0
asyncio: mode=auto, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collecting ... collected 111 items

tests/test_client.py::TestClient::test_create_client PASSED              [  0%]
tests/test_client.py::TestClient::test_collection_by_type FAILED         [  1%]
tests/test_client.py::TestClient::test_same_collection_returned FAILED   [  2%]
tests/test_client.py::TestFlushScheduling::test_flush_scheduled_on_add FAILED [  3%]
tests/test_client.py::TestFlushScheduling::test_flush_immediate_when_interval_zero FAILED [  4%]
tests/test_client.py::TestFlushScheduling::test_flush_debounced FAILED   [  5%]
tests/test_client.py::TestGlobalAPI::test_setup_and_stop PASSED          [  6%]
tests/test_client.py::TestGlobalAPI::test_collection_without_setup_raises PASSED [  7%]
tests/test_client.py::TestGlobalAPI::test_flush_without_setup_raises PASSED [  8%]
tests/test_client.py::TestGlobalAPI::test_collection_after_setup PASSED  [  9%]
tests/test_client.py::TestGlobalAPI::test_flush_tracks_operations PASSED [  9%]
tests/test_collection.py::TestCollectionCRUD::test_add_and_get PASSED    [ 10%]
tests/test_collection.py::TestCollectionCRUD::test_add_multiple PASSED   [ 11%]
tests/test_collection.py::TestCollectionCRUD::test_get_nonexistent PASSED [ 12%]
tests/test_collection.py::TestCollectionCRUD::test_delete_by_object PASSED [ 13%]
tests/test_collection.py::TestCollectionCRUD::test_delete_by_uuid PASSED [ 14%]
tests/test_collection.py::TestCollectionCRUD::test_delete_nonexistent PASSED [ 15%]
tests/test_collection.py::TestCollectionCRUD::test_contains PASSED       [ 16%]
tests/test_collection.py::TestCollectionCRUD::test_getitem PASSED        [ 17%]
tests/test_collection.py::TestCollectionCRUD::test_getitem_raises PASSED [ 18%]
tests/test_collection.py::TestCollectionCRUD::test_delitem PASSED        [ 18%]
tests/test_collection.py::TestCollectionCRUD::test_delitem_raises PASSED [ 19%]
tests/test_collection.py::TestCollectionCRUD::test_iter PASSED           [ 20%]
tests/test_collection.py::TestCollectionCRUD::test_all PASSED            [ 21%]
tests/test_collection.py::TestCollectionCRUD::test_clear PASSED          [ 22%]
tests/test_collection.py::TestCollectionFilter::test_not_loaded_raises PASSED [ 23%]
tests/test_collection.py::TestCollectionFilter::test_filter_predicate PASSED [ 24%]
tests/test_collection.py::TestCollectionFilter::test_filter_kwargs PASSED [ 25%]
tests/test_collection.py::TestCollectionFilter::test_filter_no_match PASSED [ 26%]
tests/test_collection.py::TestCollectionFilter::test_find_predicate PASSED [ 27%]
tests/test_collection.py::TestCollectionFilter::test_find_kwargs PASSED  [ 27%]
tests/test_collection.py::TestCollectionFilter::test_find_no_match PASSED [ 28%]
tests/test_collection.py::TestCollectionFilter::test_filter_with_limit PASSED [ 29%]
tests/test_collection.py::TestCollectionFilter::test_filter_predicate_and_kwargs PASSED [ 30%]
tests/test_collection.py::TestCollectionFilter::test_order_by PASSED     [ 31%]
tests/test_collection.py::TestCollectionFilter::test_order_by_reverse PASSED [ 32%]
tests/test_collection.py::TestNestedFilter::test_find_nested_kwargs PASSED [ 33%]
tests/test_collection.py::TestNestedFilter::test_filter_nested_kwargs PASSED [ 34%]
tests/test_collection.py::TestNestedFilter::test_filter_simple_field PASSED [ 35%]
tests/test_collection.py::TestIndex::test_indexed_fields_detected PASSED [ 36%]
tests/test_collection.py::TestIndex::test_index_updated_on_add PASSED    [ 36%]
tests/test_collection.py::TestIndex::test_index_updated_on_delete PASSED [ 37%]
tests/test_collection.py::TestIndex::test_index_updated_on_update PASSED [ 38%]
tests/test_collection.py::TestIndex::test_filter_uses_index PASSED       [ 39%]
tests/test_collection.py::TestIndex::test_find_uses_index PASSED         [ 40%]
tests/test_collection.py::TestIndex::test_filter_indexed_with_additional_kwargs PASSED [ 41%]
tests/test_collection.py::TestIndex::test_clear_clears_indexes PASSED    [ 42%]
tests/test_collection.py::TestEvents::test_on_change_new_item PASSED     [ 43%]
tests/test_collection.py::TestEvents::test_on_change_update_item PASSED  [ 44%]
tests/test_collection.py::TestEvents::test_on_change_no_trigger_local PASSED [ 45%]
tests/test_collection.py::TestEvents::test_on_delete PASSED              [ 45%]
tests/test_collection.py::TestEvents::test_on_delete_no_trigger_local PASSED [ 46%]
tests/test_collection.py::TestEvents::test_on_property_change PASSED     [ 47%]
tests/test_collection.py::TestEvents::test_on_property_change_nested PASSED [ 48%]
tests/test_collection.py::TestStruct::test_uuid_unique PASSED            [ 49%]
tests/test_collection.py::TestUnique::test_unique_fields_detected PASSED [ 50%]
tests/test_collection.py::TestUnique::test_unique_implies_indexed PASSED [ 51%]
tests/test_collection.py::TestUnique::test_unique_find_uses_index PASSED [ 52%]
tests/test_collection.py::TestUnique::test_unique_add_different_values PASSED [ 53%]
tests/test_collection.py::TestUnique::test_unique_add_duplicate_raises PASSED [ 54%]
tests/test_collection.py::TestUnique::test_unique_update_same_entity PASSED [ 54%]
tests/test_collection.py::TestUnique::test_unique_update_to_new_value PASSED [ 55%]
tests/test_collection.py::TestUnique::test_unique_delete_frees_value PASSED [ 56%]
tests/test_collection.py::TestUnique::test_unique_clear_frees_all PASSED [ 57%]
tests/test_collection.py::TestUnique::test_unique_none_value_allowed_multiple PASSED [ 58%]
tests/test_collection.py::TestUnique::test_unique_empty_string_is_constrained PASSED [ 59%]
tests/test_deserialization.py::TestFieldAnalysis::test_config_field_in_config ERROR [ 60%]
tests/test_deserialization.py::TestFieldAnalysis::test_indexed_field_in_indexed ERROR [ 61%]
tests/test_deserialization.py::TestFieldAnalysis::test_indexed_field_also_in_config ERROR [ 62%]
tests/test_deserialization.py::TestFieldAnalysis::test_state_field_in_state ERROR [ 63%]
tests/test_deserialization.py::TestFieldAnalysis::test_state_field_not_in_config ERROR [ 63%]
tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_in_unique ERROR [ 64%]
tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_also_indexed ERROR [ 65%]
tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_also_in_config ERROR [ 66%]
tests/test_deserialization.py::TestFromPartsDeserialization::test_config_int_preserved ERROR [ 67%]
tests/test_deserialization.py::TestFromPartsDeserialization::test_indexed_int_preserved ERROR [ 68%]
tests/test_deserialization.py::TestFromPartsDeserialization::test_state_int_preserved ERROR [ 69%]
tests/test_deserialization.py::TestFromPartsDeserialization::test_unique_int_preserved ERROR [ 70%]
tests/test_deserialization.py::TestFromPartsDeserialization::test_local_int_preserved ERROR [ 71%]
tests/test_deserialization.py::TestMixedTypesDeserialization::test_all_types_preserved ERROR [ 72%]
tests/test_deserialization.py::TestToConfigExtraction::test_config_extracts_config_fields ERROR [ 72%]
tests/test_deserialization.py::TestToConfigExtraction::test_config_extracts_indexed_fields ERROR [ 73%]
tests/test_deserialization.py::TestToConfigExtraction::test_config_does_not_extract_state_fields ERROR [ 74%]
tests/test_deserialization.py::TestToStateExtraction::test_state_extracts_state_fields ERROR [ 75%]
tests/test_deserialization.py::TestToStateExtraction::test_state_does_not_extract_config_fields ERROR [ 76%]
tests/test_deserialization.py::TestFullRoundTrip::test_full_entity_round_trip ERROR [ 77%]
tests/test_deserialization.py::TestJsonRoundTrip::test_config_through_json ERROR [ 78%]
tests/test_deserialization.py::TestJsonRoundTrip::test_state_through_json ERROR [ 79%]
tests/test_deserialization.py::TestJsonRoundTrip::test_local_through_json ERROR [ 80%]
tests/test_deserialization.py::TestJsonRoundTrip::test_full_entity_through_json ERROR [ 81%]
tests/test_deserialization.py::TestRealWorldUserPattern::test_optional_annotated_int_pattern FAILED [ 81%]
tests/test_deserialization.py::TestRealWorldUserPattern::test_nested_struct_pattern FAILED [ 82%]
tests/test_deserialization.py::TestRealWorldUserPattern::test_vcard_list_pattern FAILED [ 83%]
tests/test_deserialization.py::TestLocalClassDetection::test_optional_annotated_union_pattern FAILED [ 84%]
tests/test_deserialization.py::TestLocalClassDetection::test_optional_single_class_pattern FAILED [ 85%]
tests/test_deserialization.py::TestLocalClassDetection::test_union_without_optional_pattern FAILED [ 86%]
tests/test_fields.py::TestAnalyzeFields::test_simple_struct PASSED       [ 87%]
tests/test_fields.py::TestAnalyzeFields::test_with_state_fields PASSED   [ 88%]
tests/test_fields.py::TestAnalyzeFields::test_with_local_optional PASSED [ 89%]
tests/test_fields.py::TestAnalyzeFields::test_with_local_union PASSED    [ 90%]
tests/test_fields.py::TestAnalyzeFields::test_with_local_union_ari PASSED [ 90%]
tests/test_fields.py::TestAnalyzeFields::test_with_local_no_match PASSED [ 91%]
tests/test_fields.py::TestAnalyzeFields::test_full_struct PASSED         [ 92%]
tests/test_fields.py::TestAnalyzeFields::test_uuid_excluded PASSED       [ 93%]
tests/test_fields.py::TestAnalyzeFields::test_bucket_names PASSED        [ 94%]
tests/test_fields.py::TestAnalyzeFields::test_bucket_names_no_state PASSED [ 95%]
tests/test_fields.py::TestAnalyzeFields::test_bucket_names_no_local PASSED [ 96%]
tests/test_sync.py::TestMultiLocationSync::test_two_locations_see_same_data FAILED [ 97%]
tests/test_sync.py::TestMultiLocationSync::test_watch_receives_remote_changes FAILED [ 98%]
tests/test_sync.py::TestMultiLocationSync::test_location_tracked_in_metadata FAILED [ 99%]
tests/test_sync.py::TestMultiLocationSync::test_remote_delete_fires_event FAILED [100%]

==================================== ERRORS ====================================
_______ ERROR at setup of TestFieldAnalysis.test_config_field_in_config ________

db = <brainlessdb.client.BrainlessDB object at 0x720273de81c0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
______ ERROR at setup of TestFieldAnalysis.test_indexed_field_in_indexed _______

db = <brainlessdb.client.BrainlessDB object at 0x720273de80d0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
____ ERROR at setup of TestFieldAnalysis.test_indexed_field_also_in_config _____

db = <brainlessdb.client.BrainlessDB object at 0x720273dd1e50>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
________ ERROR at setup of TestFieldAnalysis.test_state_field_in_state _________

db = <brainlessdb.client.BrainlessDB object at 0x720273e38e50>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
______ ERROR at setup of TestFieldAnalysis.test_state_field_not_in_config ______

db = <brainlessdb.client.BrainlessDB object at 0x720273dcad60>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_______ ERROR at setup of TestFieldAnalysis.test_unique_field_in_unique ________

db = <brainlessdb.client.BrainlessDB object at 0x720273e0bd90>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
______ ERROR at setup of TestFieldAnalysis.test_unique_field_also_indexed ______

db = <brainlessdb.client.BrainlessDB object at 0x720273dcdc10>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_____ ERROR at setup of TestFieldAnalysis.test_unique_field_also_in_config _____

db = <brainlessdb.client.BrainlessDB object at 0x720273e92760>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestFromPartsDeserialization.test_config_int_preserved ___

db = <brainlessdb.client.BrainlessDB object at 0x720273dd1af0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
__ ERROR at setup of TestFromPartsDeserialization.test_indexed_int_preserved ___

db = <brainlessdb.client.BrainlessDB object at 0x720273e6beb0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestFromPartsDeserialization.test_state_int_preserved ____

db = <brainlessdb.client.BrainlessDB object at 0x720273e4ad00>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestFromPartsDeserialization.test_unique_int_preserved ___

db = <brainlessdb.client.BrainlessDB object at 0x720273df2400>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestFromPartsDeserialization.test_local_int_preserved ____

db = <brainlessdb.client.BrainlessDB object at 0x720273eae3d0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestMixedTypesDeserialization.test_all_types_preserved ___

db = <brainlessdb.client.BrainlessDB object at 0x720273e87670>

    @pytest.fixture
    async def mixed_collection(db):
>       return await db.collection(EntityMixedTypes)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:72: TypeError
_ ERROR at setup of TestToConfigExtraction.test_config_extracts_config_fields __

db = <brainlessdb.client.BrainlessDB object at 0x720273dd1f70>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_ ERROR at setup of TestToConfigExtraction.test_config_extracts_indexed_fields _

db = <brainlessdb.client.BrainlessDB object at 0x720273d3c250>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_ ERROR at setup of TestToConfigExtraction.test_config_does_not_extract_state_fields _

db = <brainlessdb.client.BrainlessDB object at 0x720273dd1220>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
___ ERROR at setup of TestToStateExtraction.test_state_extracts_state_fields ___

db = <brainlessdb.client.BrainlessDB object at 0x720273d5b160>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_ ERROR at setup of TestToStateExtraction.test_state_does_not_extract_config_fields _

db = <brainlessdb.client.BrainlessDB object at 0x720273e92970>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_______ ERROR at setup of TestFullRoundTrip.test_full_entity_round_trip ________

db = <brainlessdb.client.BrainlessDB object at 0x720273df2b50>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_________ ERROR at setup of TestJsonRoundTrip.test_config_through_json _________

db = <brainlessdb.client.BrainlessDB object at 0x720273e51eb0>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_________ ERROR at setup of TestJsonRoundTrip.test_state_through_json __________

db = <brainlessdb.client.BrainlessDB object at 0x720273d51f70>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
_________ ERROR at setup of TestJsonRoundTrip.test_local_through_json __________

db = <brainlessdb.client.BrainlessDB object at 0x720273e4ad00>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
______ ERROR at setup of TestJsonRoundTrip.test_full_entity_through_json _______

db = <brainlessdb.client.BrainlessDB object at 0x720273d22130>

    @pytest.fixture
    async def int_collection(db):
>       return await db.collection(EntityWithIntFields)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:67: TypeError
=================================== FAILURES ===================================
______________________ TestClient.test_collection_by_type ______________________

self = <tests.test_client.TestClient object at 0x7202749ecc10>
db = <brainlessdb.client.BrainlessDB object at 0x720274096fa0>

    @pytest.mark.asyncio
    async def test_collection_by_type(self, db):
>       users = await db.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_client.py:23: TypeError
___________________ TestClient.test_same_collection_returned ___________________

self = <tests.test_client.TestClient object at 0x7202749eceb0>
db = <brainlessdb.client.BrainlessDB object at 0x720273e6abb0>

    @pytest.mark.asyncio
    async def test_same_collection_returned(self, db):
>       c1 = await db.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_client.py:28: TypeError
_______________ TestFlushScheduling.test_flush_scheduled_on_add ________________

self = <tests.test_client.TestFlushScheduling object at 0x720274a041f0>

    @pytest.mark.asyncio
    async def test_flush_scheduled_on_add(self):
        db = BrainlessDB(namespace="test", flush_interval=0.05)
>       users = await db.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_client.py:39: TypeError
_________ TestFlushScheduling.test_flush_immediate_when_interval_zero __________

self = <tests.test_client.TestFlushScheduling object at 0x7202749ecdc0>

    @pytest.mark.asyncio
    async def test_flush_immediate_when_interval_zero(self):
        db = BrainlessDB(namespace="test", flush_interval=0)
>       users = await db.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_client.py:50: TypeError
___________________ TestFlushScheduling.test_flush_debounced ___________________

self = <tests.test_client.TestFlushScheduling object at 0x720274a04070>

    @pytest.mark.asyncio
    async def test_flush_debounced(self):
        db = BrainlessDB(namespace="test", flush_interval=0.1)
>       users = await db.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_client.py:59: TypeError
_________ TestRealWorldUserPattern.test_optional_annotated_int_pattern _________

self = <tests.test_deserialization.TestRealWorldUserPattern object at 0x720273f12a60>

    @pytest.mark.asyncio
    async def test_optional_annotated_int_pattern(self):
        """Test Optional[Annotated[int, Meta(...)]] pattern like queue_reason."""
        from enum import IntEnum
        import msgspec
        from brainlessdb import BrainlessDB, BrainlessDBFeat, BrainlessBucket
        from brainlessdb.struct import ConfigWrapper

        class Status(IntEnum):
            OFFLINE = 0
            ONLINE = 1

        class UserLike(BrainlessBucket):
            id: Annotated[int, Meta(extra={"brainlessdb_flags": BrainlessDBFeat.INDEX})] = 0
            group_id: int = 0
            # Pattern from queue_reason - Optional[Annotated[int, ...]]
            queue_reason: Optional[Annotated[int, Meta(description="")]] = None
            queue_status_changed: Optional[Annotated[int, Meta(description="")]] = None
            # State field with enum
            status: Annotated[Status, Meta(extra={"brainlessdb_flags": BrainlessDBFeat.STATE})] = Status.OFFLINE

        db = BrainlessDB(namespace="test")
>       coll = await db.collection(UserLike)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:443: TypeError
_____________ TestRealWorldUserPattern.test_nested_struct_pattern ______________

self = <tests.test_deserialization.TestRealWorldUserPattern object at 0x720273f12ca0>

    @pytest.mark.asyncio
    async def test_nested_struct_pattern(self):
        """Test nested struct like AgentChannelsV1."""
        import msgspec
        from brainlessdb import BrainlessDB, BrainlessBucket
        from brainlessdb.struct import ConfigWrapper

        class Channels(Struct):
            voice: int = 0
            chat: int = 0

        class UserWithChannels(BrainlessBucket):
            id: int = 0
            channels: Channels = field(default_factory=Channels)

        db = BrainlessDB(namespace="test")
>       coll = await db.collection(UserWithChannels)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:500: TypeError
_______________ TestRealWorldUserPattern.test_vcard_list_pattern _______________

self = <tests.test_deserialization.TestRealWorldUserPattern object at 0x720273f12ee0>

    @pytest.mark.asyncio
    async def test_vcard_list_pattern(self):
        """Test list of nested structs like vcard: list[VCardV1]."""
        import msgspec
        from brainlessdb import BrainlessDB, BrainlessBucket
        from brainlessdb.struct import ConfigWrapper

        class VCard(Struct):
            name: str = ""
            value: str = ""

        class UserWithVCard(BrainlessBucket):
            id: int = 0
            vcard: Optional[list[VCard]] = None

        db = BrainlessDB(namespace="test")
>       coll = await db.collection(UserWithVCard)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:535: TypeError
________ TestLocalClassDetection.test_optional_annotated_union_pattern _________

self = <tests.test_deserialization.TestLocalClassDetection object at 0x720273f191f0>

    @pytest.mark.asyncio
    async def test_optional_annotated_union_pattern(self):
        """Test Optional[Annotated[Union[A, B], Meta()]] pattern from UserV2."""
        from brainlessdb import BrainlessDB, BrainlessBucket

        class AriLocal(Struct):
            counter: int = 0

        class UcsLocal(Struct):
            counter: int = 0

        class UserWithUnionLocal(BrainlessBucket):
            id: int = 0
            _: Optional[Annotated[Union[UcsLocal, AriLocal], Meta()]] = None

        # Test with "ari" namespace - should find AriLocal
        db_ari = BrainlessDB(namespace="ari")
>       coll_ari = await db_ari.collection(UserWithUnionLocal)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:578: TypeError
__________ TestLocalClassDetection.test_optional_single_class_pattern __________

self = <tests.test_deserialization.TestLocalClassDetection object at 0x720273f19430>

    @pytest.mark.asyncio
    async def test_optional_single_class_pattern(self):
        """Test Optional[LocalClass] pattern."""
        from brainlessdb import BrainlessDB, BrainlessBucket

        class TestLocal(Struct):
            value: int = 0

        class UserWithLocal(BrainlessBucket):
            id: int = 0
            _: Optional[TestLocal] = None

        db = BrainlessDB(namespace="test")
>       coll = await db.collection(UserWithLocal)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:599: TypeError
_________ TestLocalClassDetection.test_union_without_optional_pattern __________

self = <tests.test_deserialization.TestLocalClassDetection object at 0x720273f12d60>

    @pytest.mark.asyncio
    async def test_union_without_optional_pattern(self):
        """Test Union[A, B] (without Optional) pattern."""
        from brainlessdb import BrainlessDB, BrainlessBucket

        class AriData(Struct):
            x: int = 0

        class UcsData(Struct):
            x: int = 0

        class UserUnion(BrainlessBucket):
            id: int = 0
            _: Union[UcsData, AriData] = field(default_factory=UcsData)

        db = BrainlessDB(namespace="ari")
>       coll = await db.collection(UserUnion)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_deserialization.py:618: TypeError
____________ TestMultiLocationSync.test_two_locations_see_same_data ____________

self = <tests.test_sync.TestMultiLocationSync object at 0x720273f197c0>

    @pytest.mark.asyncio
    async def test_two_locations_see_same_data(self):
        """Both locations can read data written by either."""
        nats = MockNats()

        db1 = BrainlessDB(nats, namespace="loc1", flush_interval=0)
        db2 = BrainlessDB(nats, namespace="loc2", flush_interval=0)
        await db1.start()
        await db2.start()

>       users1 = await db1.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_sync.py:25: TypeError
___________ TestMultiLocationSync.test_watch_receives_remote_changes ___________

self = <tests.test_sync.TestMultiLocationSync object at 0x720273f125b0>

    @pytest.mark.asyncio
    async def test_watch_receives_remote_changes(self):
        """Watch fires when other location makes changes."""
        nats = MockNats()

        db1 = BrainlessDB(nats, namespace="loc1", flush_interval=0)
        db2 = BrainlessDB(nats, namespace="loc2", flush_interval=0)
        await db1.start()
        await db2.start()

>       users1 = await db1.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_sync.py:55: TypeError
___________ TestMultiLocationSync.test_location_tracked_in_metadata ____________

self = <tests.test_sync.TestMultiLocationSync object at 0x720273eadd00>

    @pytest.mark.asyncio
    async def test_location_tracked_in_metadata(self):
        """Config bucket tracks which location made the change."""
        nats = MockNats()

        db1 = BrainlessDB(nats, namespace="loc1", flush_interval=0)
        await db1.start()

>       users1 = await db1.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_sync.py:89: TypeError
_____________ TestMultiLocationSync.test_remote_delete_fires_event _____________

self = <tests.test_sync.TestMultiLocationSync object at 0x720273ead040>

    @pytest.mark.asyncio
    async def test_remote_delete_fires_event(self):
        """Delete from one location fires event on other."""
        nats = MockNats()

        db1 = BrainlessDB(nats, namespace="loc1", flush_interval=0)
        db2 = BrainlessDB(nats, namespace="loc2", flush_interval=0)
        await db1.start()
        await db2.start()

>       users1 = await db1.collection(UserV1)
E       TypeError: object Collection can't be used in 'await' expression

tests/test_sync.py:111: TypeError
=========================== short test summary info ============================
FAILED tests/test_client.py::TestClient::test_collection_by_type - TypeError:...
FAILED tests/test_client.py::TestClient::test_same_collection_returned - Type...
FAILED tests/test_client.py::TestFlushScheduling::test_flush_scheduled_on_add
FAILED tests/test_client.py::TestFlushScheduling::test_flush_immediate_when_interval_zero
FAILED tests/test_client.py::TestFlushScheduling::test_flush_debounced - Type...
FAILED tests/test_deserialization.py::TestRealWorldUserPattern::test_optional_annotated_int_pattern
FAILED tests/test_deserialization.py::TestRealWorldUserPattern::test_nested_struct_pattern
FAILED tests/test_deserialization.py::TestRealWorldUserPattern::test_vcard_list_pattern
FAILED tests/test_deserialization.py::TestLocalClassDetection::test_optional_annotated_union_pattern
FAILED tests/test_deserialization.py::TestLocalClassDetection::test_optional_single_class_pattern
FAILED tests/test_deserialization.py::TestLocalClassDetection::test_union_without_optional_pattern
FAILED tests/test_sync.py::TestMultiLocationSync::test_two_locations_see_same_data
FAILED tests/test_sync.py::TestMultiLocationSync::test_watch_receives_remote_changes
FAILED tests/test_sync.py::TestMultiLocationSync::test_location_tracked_in_metadata
FAILED tests/test_sync.py::TestMultiLocationSync::test_remote_delete_fires_event
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_config_field_in_config
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_indexed_field_in_indexed
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_indexed_field_also_in_config
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_state_field_in_state
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_state_field_not_in_config
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_in_unique
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_also_indexed
ERROR tests/test_deserialization.py::TestFieldAnalysis::test_unique_field_also_in_config
ERROR tests/test_deserialization.py::TestFromPartsDeserialization::test_config_int_preserved
ERROR tests/test_deserialization.py::TestFromPartsDeserialization::test_indexed_int_preserved
ERROR tests/test_deserialization.py::TestFromPartsDeserialization::test_state_int_preserved
ERROR tests/test_deserialization.py::TestFromPartsDeserialization::test_unique_int_preserved
ERROR tests/test_deserialization.py::TestFromPartsDeserialization::test_local_int_preserved
ERROR tests/test_deserialization.py::TestMixedTypesDeserialization::test_all_types_preserved
ERROR tests/test_deserialization.py::TestToConfigExtraction::test_config_extracts_config_fields
ERROR tests/test_deserialization.py::TestToConfigExtraction::test_config_extracts_indexed_fields
ERROR tests/test_deserialization.py::TestToConfigExtraction::test_config_does_not_extract_state_fields
ERROR tests/test_deserialization.py::TestToStateExtraction::test_state_extracts_state_fields
ERROR tests/test_deserialization.py::TestToStateExtraction::test_state_does_not_extract_config_fields
ERROR tests/test_deserialization.py::TestFullRoundTrip::test_full_entity_round_trip
ERROR tests/test_deserialization.py::TestJsonRoundTrip::test_config_through_json
ERROR tests/test_deserialization.py::TestJsonRoundTrip::test_state_through_json
ERROR tests/test_deserialization.py::TestJsonRoundTrip::test_local_through_json
ERROR tests/test_deserialization.py::TestJsonRoundTrip::test_full_entity_through_json
=================== 15 failed, 72 passed, 24 errors in 0.29s ===================
