langchain_core.utils.utils.mock_now¶

langchain_core.utils.utils.mock_now(dt_value)[source]¶

Context manager for mocking out datetime.now() in unit tests.

Example: with mock_now(datetime.datetime(2011, 2, 3, 10, 11)):

assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11)