diff --git a/antithesis-tests/stress-composer/utils.py b/antithesis-tests/stress-composer/utils.py index f99052bf3..358e44670 100755 --- a/antithesis-tests/stress-composer/utils.py +++ b/antithesis-tests/stress-composer/utils.py @@ -4,17 +4,16 @@ from antithesis.random import get_random, random_choice def generate_random_identifier(type: str, num: int): return ''.join(type, '_', get_random() % num) -def generate_random_value(type: str): - match type: - case 'INTEGER': - return str(get_random() % 100) - case 'REAL': - return '{:.2f}'.format(get_random() % 100 / 100.0) - case 'TEXT': - return f"'{''.join(random_choice(string.ascii_lowercase) for _ in range(5))}'" - case 'BLOB': - return f"x'{''.join(random_choice(string.ascii_lowercase) for _ in range(5)).encode().hex()}'" - case 'NUMERIC': - return str(get_random() % 100) - case _: - return NULL \ No newline at end of file +def generate_random_value(type_str): + if type_str == 'INTEGER': + return str(get_random() % 100) + elif type_str == 'REAL': + return '{:.2f}'.format(get_random() % 100 / 100.0) + elif type_str == 'TEXT': + return f"'{''.join(random_choice(string.ascii_lowercase) for _ in range(5))}'" + elif type_str == 'BLOB': + return f"x'{''.join(random_choice(string.ascii_lowercase) for _ in range(5)).encode().hex()}'" + elif type_str == 'NUMERIC': + return str(get_random() % 100) + else: + return NULL