Home / Function/ test_update_timestamp() — langchain Function Reference

test_update_timestamp() — langchain Function Reference

Architecture documentation for the test_update_timestamp() function in test_in_memory_record_manager.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5ea7fe04_c085_459f_1780_90fdc26e0b28["test_update_timestamp()"]
  0a49adf9_8741_0192_f95b_5cb8cd00ab22["test_in_memory_record_manager.py"]
  5ea7fe04_c085_459f_1780_90fdc26e0b28 -->|defined in| 0a49adf9_8741_0192_f95b_5cb8cd00ab22
  style 5ea7fe04_c085_459f_1780_90fdc26e0b28 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_in_memory_record_manager.py lines 54–95

def test_update_timestamp(manager: InMemoryRecordManager) -> None:
    """Test updating records in the database."""
    # no keys should be present in the set
    with patch.object(
        manager,
        "get_time",
        return_value=datetime(2021, 1, 2, tzinfo=timezone.utc).timestamp(),
    ):
        manager.update(["key1"])

    assert manager.list_keys() == ["key1"]
    assert (
        manager.list_keys(before=datetime(2021, 1, 1, tzinfo=timezone.utc).timestamp())
        == []
    )
    assert manager.list_keys(
        after=datetime(2021, 1, 1, tzinfo=timezone.utc).timestamp()
    ) == ["key1"]
    assert (
        manager.list_keys(after=datetime(2021, 1, 3, tzinfo=timezone.utc).timestamp())
        == []
    )

    # Update the timestamp
    with patch.object(
        manager,
        "get_time",
        return_value=datetime(2023, 1, 5, tzinfo=timezone.utc).timestamp(),
    ):
        manager.update(["key1"])

    assert manager.list_keys() == ["key1"]
    assert (
        manager.list_keys(before=datetime(2023, 1, 1, tzinfo=timezone.utc).timestamp())
        == []
    )
    assert manager.list_keys(
        after=datetime(2023, 1, 1, tzinfo=timezone.utc).timestamp()
    ) == ["key1"]
    assert manager.list_keys(
        after=datetime(2023, 1, 3, tzinfo=timezone.utc).timestamp()
    ) == ["key1"]

Subdomains

Frequently Asked Questions

What does test_update_timestamp() do?
test_update_timestamp() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/indexing/test_in_memory_record_manager.py.
Where is test_update_timestamp() defined?
test_update_timestamp() is defined in libs/core/tests/unit_tests/indexing/test_in_memory_record_manager.py at line 54.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free