Skip to content

Commit

Permalink
removed verify_reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Relm-Arrowny committed Apr 24, 2024
1 parent 5470bea commit c0cab3d
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions src/ophyd_async/core/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import (
Any,
AsyncGenerator,
Awaitable,
Callable,
Dict,
Generic,
Expand Down Expand Up @@ -285,34 +284,6 @@ def soft_signal_r_and_backend(
return (signal, backend)


async def _verify_readings(
func: Callable[[], Mapping[str, Reading] | Awaitable[Mapping[str, Reading]]],
expectation: Mapping[str, Reading],
) -> None:
"""Take a read/read_configuration function that return a dictionary and
compare it with the expected result (expectation)
Parameters
----------
func:
read/read_configuration function.
expectation:
The expected value from the readable/Configurable.
Notes
-----
Example usage::
await _verify_readings(readable.read, reading)
Or::
await _verify_readings(configurable.read_configuration, configuration)
"""
result = await func()

assert result == expectation


async def assert_value(signal: SignalR[T], value: Any) -> None:
"""Assert a signal's value and compare it an expected signal.
Expand Down Expand Up @@ -351,7 +322,7 @@ async def assert_reading(
await assert_reading(readable, reading)
"""
await _verify_readings(readable.read, reading)
assert await readable.read() == reading


async def assert_configuration(
Expand All @@ -374,7 +345,7 @@ async def assert_configuration(
await assert_configuration(configurable configuration)
"""
await _verify_readings(configurable.read_configuration, configuration)
assert await configurable.read_configuration() == configuration


def assert_emitted(docs: Mapping[str, list[DocumentType]], **numbers: int):
Expand Down

0 comments on commit c0cab3d

Please sign in to comment.