File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,18 @@ def test_get_internal_type(self):
17
17
f = ObjectIdField ()
18
18
self .assertEqual (f .get_internal_type (), "ObjectIdField" )
19
19
20
- def test_to_python (self ):
21
- f = ObjectIdField ()
22
- expected = ObjectId ("1" * 24 )
23
- for value in ["1" * 24 , ObjectId ("1" * 24 )]:
24
- with self .subTest (value = value ):
25
- self .assertEqual (f .to_python (value ), expected )
26
- with self .subTest (value = None ):
27
- self .assertIsNone (f .to_python (None ))
20
+ def test_to_python_string (self ):
21
+ base_string = "1" * 24
22
+ expected = ObjectId (base_string )
23
+ self .assertEqual (ObjectIdField ().to_python (base_string ), expected )
24
+
25
+ def test_to_python_objectid (self ):
26
+ base_string = "1" * 24
27
+ expected = ObjectId (base_string )
28
+ self .assertEqual (ObjectIdField ().to_python (expected ), expected )
29
+
30
+ def test_to_python_null_value (self ):
31
+ self .assertIsNone (ObjectIdField ().to_python (None ))
28
32
29
33
def test_to_python_invalid_value (self ):
30
34
for invalid_value in ["None" , {}, []]:
You can’t perform that action at this time.
0 commit comments