Skip to content

Commit

Permalink
test: allow end times to be the same on nested context managers
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMaggio committed Apr 8, 2024
1 parent 9405ad8 commit 8cddde2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async def test_nested_synchronous_functions() -> None:
assert outer_time.start_time < outer_time.end_time
assert inner_time.start_time < inner_time.end_time
assert outer_time.start_time < inner_time.start_time
assert outer_time.end_time > inner_time.end_time
assert outer_time.end_time >= inner_time.end_time

async def test_timing_sychronous_function_nested_inside_async_function() -> None:
"""Tests that the FunctionTimer correctly times a synchronous function inside an asynchronous context manager."""
Expand All @@ -132,7 +132,7 @@ async def test_timing_sychronous_function_nested_inside_async_function() -> None
assert async_time.start_time < async_time.end_time
assert sync_time.start_time < sync_time.end_time
assert async_time.start_time < sync_time.start_time
assert async_time.end_time > sync_time.end_time
assert async_time.end_time >= sync_time.end_time


def test_instantaneous_function() -> None:
Expand Down Expand Up @@ -204,7 +204,7 @@ async def test_function_timer_with_async_contexts() -> None:
assert f1_time.start_time < f1_time.end_time
assert f2_time.start_time < f2_time.end_time
assert f1_time.start_time < f2_time.start_time
assert f1_time.end_time > f2_time.end_time
assert f1_time.end_time >= f2_time.end_time

def test_direct_use_without_context_manager():
timer = FunctionTimer()
Expand Down

0 comments on commit 8cddde2

Please sign in to comment.