This commit is contained in:
@@ -63,6 +63,7 @@ def strip_ansi(text):
|
|||||||
def test_put_with_progress_and_repr(value, expected_color):
|
def test_put_with_progress_and_repr(value, expected_color):
|
||||||
pv = PV("TEST:VAL", connection_timeout=2.0)
|
pv = PV("TEST:VAL", connection_timeout=2.0)
|
||||||
assert pv.wait_for_connection(timeout=2.0), "PV not connected"
|
assert pv.wait_for_connection(timeout=2.0), "PV not connected"
|
||||||
|
pv.units = "//"
|
||||||
|
|
||||||
pv.put(0.0, wait=True)
|
pv.put(0.0, wait=True)
|
||||||
assert pv.get() == pytest.approx(0.0)
|
assert pv.get() == pytest.approx(0.0)
|
||||||
@@ -86,11 +87,11 @@ def test_put_with_progress_and_repr(value, expected_color):
|
|||||||
|
|
||||||
# Initialisation bar
|
# Initialisation bar
|
||||||
matches = [line for line in cleaned_lines if f"| |" in line]
|
matches = [line for line in cleaned_lines if f"| |" in line]
|
||||||
assert matches, f"Expected bar '{expected_bar}' not found in:\n" + "\n".join(printed_lines)
|
assert matches, f"Expected bar not found in:\n" + "\n".join(printed_lines)
|
||||||
|
|
||||||
# Vérifie que la bonne barre a été affichée au moins une fois
|
# Vérifie que la bonne barre a été affichée au moins une fois
|
||||||
matches = [line for line in cleaned_lines if f"|██████████████████████████████|" in line]
|
matches = [line for line in cleaned_lines if f"|██████████████████████████████|" in line]
|
||||||
assert matches, f"Expected bar '{expected_bar}' not found in:\n" + "\n".join(printed_lines)
|
assert matches, f"Expected bar not found in:\n" + "\n".join(printed_lines)
|
||||||
|
|
||||||
# Vérifie que la couleur est bien utilisée (au moins une fois dans les lignes printées)
|
# Vérifie que la couleur est bien utilisée (au moins une fois dans les lignes printées)
|
||||||
color_matches = [line for line in printed_lines if expected_color in line]
|
color_matches = [line for line in printed_lines if expected_color in line]
|
||||||
@@ -100,7 +101,7 @@ def test_put_with_progress_and_repr(value, expected_color):
|
|||||||
assert pv.get() == pytest.approx(value)
|
assert pv.get() == pytest.approx(value)
|
||||||
|
|
||||||
# Représentation
|
# Représentation
|
||||||
expected_repr = f'PV "TEST:VAL" at {value} units'
|
expected_repr = f'PV "TEST:VAL" at {value} //'
|
||||||
assert repr(pv) == expected_repr
|
assert repr(pv) == expected_repr
|
||||||
assert pv.orig_repr().startswith('<epics.pv.PV')
|
assert pv.orig_repr().startswith('<epics.pv.PV')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user