Skip to content

Commit 0d1b0a4

Browse files
committed
Rename test classes
1 parent e44d236 commit 0d1b0a4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/expression_converter_/test_op_expressions.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django_mongodb_backend.query_conversion.expression_converters import convert_expression
88

99

10-
class TestBaseExpressionConversionCase(SimpleTestCase):
10+
class ExpressionConversionTestCase(SimpleTestCase):
1111
CONVERTIBLE_TYPES = {
1212
"int": 42,
1313
"float": 3.14,
@@ -28,6 +28,13 @@ def assertNotOptimizable(self, input):
2828
result = convert_expression(input)
2929
self.assertIsNone(result)
3030

31+
def _test_conversion_various_types(self, conversion_test):
32+
for _type, val in self.CONVERTIBLE_TYPES.items():
33+
with self.subTest(_type=_type, val=val):
34+
conversion_test(val)
35+
36+
37+
class TestExpressionConversion(ExpressionConversionTestCase):
3138
def test_non_dict_expression(self):
3239
expr = ["$status", "active"]
3340
self.assertNotOptimizable(expr)
@@ -40,13 +47,8 @@ def test_non_convertible(self):
4047
expr = {"$gt": ["$price", 100]}
4148
self.assertNotOptimizable(expr)
4249

43-
def _test_conversion_various_types(self, conversion_test):
44-
for _type, val in self.CONVERTIBLE_TYPES.items():
45-
with self.subTest(_type=_type, val=val):
46-
conversion_test(val)
47-
4850

49-
class TestEqExprConversionCase(TestBaseExpressionConversionCase):
51+
class TestEqExprConversion(ExpressionConversionTestCase):
5052
def test_eq_conversion(self):
5153
expr = {"$eq": ["$status", "active"]}
5254
expected = {"status": "active"}
@@ -77,7 +79,7 @@ def test_eq_conversion_various_array_types(self):
7779
self._test_conversion_various_types(self._test_eq_conversion_valid_array_type)
7880

7981

80-
class TestInExprConversionCase(TestBaseExpressionConversionCase):
82+
class TestInExprConversion(ExpressionConversionTestCase):
8183
def test_in_conversion(self):
8284
expr = {"$in": ["$category", ["electronics", "books", "clothing"]]}
8385
expected = {"category": {"$in": ["electronics", "books", "clothing"]}}
@@ -115,7 +117,7 @@ def test_in_conversion_various_types(self):
115117
self._test_in_conversion_valid_type(val)
116118

117119

118-
class TestLogicalExpressionConversionCase(TestBaseExpressionConversionCase):
120+
class TestLogicalExpressionConversion(ExpressionConversionTestCase):
119121
def test_logical_and_conversion(self):
120122
expr = {
121123
"$and": [

0 commit comments

Comments
 (0)