From 4d25e97d6760e6a5db8271dcd3f81ad3c671a232 Mon Sep 17 00:00:00 2001 From: Manuel Montenegro Date: Tue, 21 Mar 2023 12:31:40 +0100 Subject: [PATCH] Use fixed binary value for test The use of randomly generated values for pytest parameters may cause errors in test explorer in Visual Studio Code. Specifically, `test_return_value_serialization` test returns the following error when a random parameter is used: ``` Test result not found for: ./tests/unit/conditions/test_return_value.py::test_return_value_serialization [\xbd\x01\t\xecV\x05\x04\xe2\x9b(\xb6\xcef\xea\xa4\xfa] ``` Since the rest of values used in this test are fixed, there is no reason to use a random value for bytes parameter. --- tests/unit/conditions/test_return_value.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/unit/conditions/test_return_value.py b/tests/unit/conditions/test_return_value.py index 59baa2fa1..4dda07ce1 100644 --- a/tests/unit/conditions/test_return_value.py +++ b/tests/unit/conditions/test_return_value.py @@ -41,7 +41,6 @@ def test_return_value_index(): _ = ReturnValueTest(comparator=">", value="0", index="james") - def test_return_value_index(): test = ReturnValueTest(comparator=">", value="0", index=0) assert test.eval([1]) @@ -60,8 +59,6 @@ def test_return_value_index_tuple(): assert not test.eval((-1,)) - - def test_return_value_test_invalid_comparators(): with pytest.raises(ReturnValueTest.InvalidExpression): _ = ReturnValueTest(comparator="eq", value=1) @@ -216,7 +213,7 @@ def test_return_value_test_bool(): "0xaDD9D957170dF6F33982001E4c22eCCdd5539118", # string that is evaluated as int 125, # int 1.223, # float - os.urandom(16), # bytes + b"\xe4\xe4u\x18\x03\x81i\xb74\x0e\xf5\xeb\x18\xf0\x0f\x82", # bytes True, # bool "True", # bool as string (1, True, "love"), # tuple