Skip to content

Commit 470cdf8

Browse files
committed
Add black check to unit test.
1 parent 617cf29 commit 470cdf8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/model_fields_/test_objectidfield.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import shutil
2+
13
from bson import ObjectId
24
from django.core import exceptions
35
from django.test import SimpleTestCase
46

57
from django_mongodb.fields import ObjectIdField
68

9+
HAS_BLACK = shutil.which("black")
10+
711

812
class MethodTests(SimpleTestCase):
913
def test_deconstruct(self):
@@ -29,6 +33,9 @@ def test_to_python(self):
2933
def test_to_python_invalid_value(self):
3034
for invalid_value in [3, "None", {}, []]:
3135
with self.subTest(invalid_value=invalid_value):
32-
msg = f"['“{invalid_value}” value must be an Object Id.']"
36+
if HAS_BLACK:
37+
msg = f'["“{invalid_value}” value must be an Object Id."]'
38+
else:
39+
msg = f"['“{invalid_value}” value must be an Object Id.']"
3340
with self.assertRaisesMessage(exceptions.ValidationError, msg):
3441
ObjectIdField().to_python(invalid_value)

0 commit comments

Comments
 (0)