Example #1
0
def dict_key_store() -> KeyStore:
    return KeyStore(
        keys=["name", "value", "repeat_value", "date"],
        objects=[
            EXAMPLE_DICT_1,
            EXAMPLE_DICT_2,
            EXAMPLE_DICT_3,
        ]
    )
Example #2
0
def test_key_store__get_one_or_none__success__with_objs(
    kwargs: Dict[str, Any],
    expected_output: Optional[ExampleObj],
    expected_cache: Dict[Tuple, List],
    obj_key_store: KeyStore,
) -> None:
    output = obj_key_store.get_one_or_none(**kwargs)
    assert output == expected_output
    assert obj_key_store._cache == expected_cache
Example #3
0
def obj_key_store() -> KeyStore:
    return KeyStore(
        keys=["name", "value", "repeat_value", "date"],
        objects=[
            EXAMPLE_OBJ_1,
            EXAMPLE_OBJ_2,
            EXAMPLE_OBJ_3,
        ]
    )
Example #4
0
def test_key_store__get__failure__with_dicts(
    kwargs: Dict[str, Any],
    expected_output: Optional[ExampleObj],
    expected_cache: Dict[Tuple, List],
    dict_key_store: KeyStore,
) -> None:
    with pytest.raises(Exception):
        output = dict_key_store.get_one_or_none(**kwargs)
        assert output == expected_output
        assert dict_key_store._cache == expected_cache