From 81dcee00bc5fabc1e3751d362872e9a43f20fee4 Mon Sep 17 00:00:00 2001 From: Evgeniy Blinov Date: Wed, 7 Aug 2024 15:27:00 +0300 Subject: [PATCH] old tests fixed --- tests/units/tokens/abstract/test_abstract_token.py | 12 ++++++++---- tests/units/tokens/test_simple_token.py | 5 +---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/units/tokens/abstract/test_abstract_token.py b/tests/units/tokens/abstract/test_abstract_token.py index eeb15b4..d4f285d 100644 --- a/tests/units/tokens/abstract/test_abstract_token.py +++ b/tests/units/tokens/abstract/test_abstract_token.py @@ -173,10 +173,14 @@ def test_add_not_temp_tokens(first_token_fabric, second_token_fabric): def test_add_temp_tokens(first_token_class, second_token_class, first_arguments, second_arguments): tokens_sum = first_token_class(*first_arguments) + second_token_class(*second_arguments) - assert isinstance(tokens_sum, first_token_class) - assert len(tokens_sum.tokens) == 1 - assert isinstance(tokens_sum.tokens[0], second_token_class) - assert len(tokens_sum.tokens[0].tokens) == 0 + if not (first_token_class is TimeoutToken and second_token_class is TimeoutToken): + assert isinstance(tokens_sum, first_token_class) + assert len(tokens_sum.tokens) == 1 + assert isinstance(tokens_sum.tokens[0], second_token_class) + assert len(tokens_sum.tokens[0].tokens) == 0 + else: + assert isinstance(tokens_sum, TimeoutToken) + assert len(tokens_sum.tokens) == 0 @pytest.mark.parametrize( diff --git a/tests/units/tokens/test_simple_token.py b/tests/units/tokens/test_simple_token.py index 33a74a4..6763a92 100644 --- a/tests/units/tokens/test_simple_token.py +++ b/tests/units/tokens/test_simple_token.py @@ -196,12 +196,9 @@ def test_sum_of_2_temp_timeout_tokens_throw_right_temp_simple_token(): token = TimeoutToken(1) + SimpleToken(TimeoutToken(2)) assert isinstance(token, TimeoutToken) - assert len(token.tokens) == 1 + assert len(token.tokens) == 0 assert token.timeout == 1 - assert isinstance(token.tokens[0], TimeoutToken) - assert token.tokens[0].timeout == 2 - def test_sum_of_2_temp_timeout_tokens_throw_left_temp_simple_token(): token = SimpleToken(TimeoutToken(1)) + TimeoutToken(2)