diff --git a/tests/flagpole/test_conditions.py b/tests/flagpole/test_conditions.py index 4901ee627db0a0..5d7b1023cede50 100644 --- a/tests/flagpole/test_conditions.py +++ b/tests/flagpole/test_conditions.py @@ -1,5 +1,6 @@ from typing import Any +import orjson import pytest from pydantic import ValidationError @@ -15,11 +16,9 @@ NotInCondition, create_case_insensitive_set_from_list, ) -from sentry.testutils.cases import TestCase -from sentry.utils import json -class TestCreateCaseInsensitiveSetFromList(TestCase): +class TestCreateCaseInsensitiveSetFromList: def test_empty_set(self): assert create_case_insensitive_set_from_list([]) == set() @@ -36,7 +35,7 @@ def test_returns_lowercase_string_set(self): def assert_valid_types(condition: type[ConditionBase], expected_types: list[Any]): for value in expected_types: condition_dict = dict(property="test", value=value) - json_condition = json.dumps(condition_dict) + json_condition = orjson.dumps(condition_dict) try: parsed_condition = condition.parse_raw(json_condition) except ValidationError as exc: @@ -49,7 +48,7 @@ def assert_valid_types(condition: type[ConditionBase], expected_types: list[Any] def assert_invalid_types(condition: type[ConditionBase], invalid_types: list[Any]): for value in invalid_types: json_dict = dict(value=value) - condition_json = json.dumps(json_dict) + condition_json = orjson.dumps(json_dict) try: condition.parse_raw(condition_json) except ValidationError: @@ -60,7 +59,7 @@ def assert_invalid_types(condition: type[ConditionBase], invalid_types: list[Any ) -class TestInConditions(TestCase): +class TestInConditions: def test_invalid_values(self): with pytest.raises(ValidationError): InCondition(property="foo", value="bar") @@ -144,7 +143,7 @@ def test_missing_context_property(self): ) -class TestContainsConditions(TestCase): +class TestContainsConditions: def test_does_contain(self): condition = ContainsCondition(property="foo", value="bar") assert condition.match( @@ -216,7 +215,7 @@ def test_missing_context_property(self): ) -class TestEqualsConditions(TestCase): +class TestEqualsConditions: def test_is_equal_string(self): value = "foo" condition = EqualsCondition(property="foo", value=value)