def test_continue_running_no_asserts_no_remaining(): actions = [Action(name="some-action")] asserts = [] assert not testing.continue_running( actions=actions, asserts=asserts, remaining_cycles=0, actions_data={}, assert_statuses={}, )
def test_continue_running_actions_with_asserts_first_run(): actions = [Action(name="bar", asserts=[Assert(name="foo")])] asserts = [] assert testing.continue_running( actions=actions, asserts=asserts, remaining_cycles=-1, actions_data={}, assert_statuses={}, )
def test_continue_running_actions_with_asserts_failed_limited_second_run(): actions = [Action(name="bar", asserts=[Assert(name="foo")])] asserts = [] actions_data = { "bar": { "asserts": { "foo": AssertResult(passed=False, actual="", expected="", description="") } } } assert not testing.continue_running( actions=actions, asserts=asserts, remaining_cycles=0, actions_data=actions_data, assert_statuses={}, )
def action_has_asserts(action: Action): return action.get("asserts", []) != []
def test_get_default_cycles_actions_have_asserts(): default_cycles = testing.get_default_cycles( asserts=[], actions=[Action(name="bar", asserts=[Assert(name="foo")])]) assert default_cycles == -1
def test_get_default_cycles_actions_only(): default_cycles = testing.get_default_cycles(asserts=[], actions=[Action(name="bar")]) assert default_cycles == 1