@@ -343,7 +343,9 @@ class Invalid(models.Model):
343
343
assert len (errors ) == 1
344
344
assert errors [0 ].id == "django_mysql.E009"
345
345
assert "'spec' must be a dict" in errors [0 ].msg
346
- assert "The value passed is of type list" in errors [0 ].hint
346
+ hint = errors [0 ].hint
347
+ assert hint is not None
348
+ assert "The value passed is of type list" in hint
347
349
348
350
def test_spec_key_not_valid (self ):
349
351
class Invalid (models .Model ):
@@ -353,8 +355,10 @@ class Invalid(models.Model):
353
355
assert len (errors ) == 1
354
356
assert errors [0 ].id == "django_mysql.E010"
355
357
assert "The key '2.0' in 'spec' is not a string" in errors [0 ].msg
356
- assert "'spec' keys must be of type " in errors [0 ].hint
357
- assert "'2.0' is of type float" in errors [0 ].hint
358
+ hint = errors [0 ].hint
359
+ assert hint is not None
360
+ assert "'spec' keys must be of type " in hint
361
+ assert "'2.0' is of type float" in hint
358
362
359
363
def test_spec_value_not_valid (self ):
360
364
class Invalid (models .Model ):
@@ -364,9 +368,10 @@ class Invalid(models.Model):
364
368
assert len (errors ) == 1
365
369
assert errors [0 ].id == "django_mysql.E011"
366
370
assert "The value for 'bad' in 'spec' is not an allowed type" in errors [0 ].msg
371
+ hint = errors [0 ].hint
372
+ assert hint is not None
367
373
assert (
368
- "'spec' values must be one of the following types: date, datetime"
369
- in errors [0 ].hint
374
+ "'spec' values must be one of the following types: date, datetime" in hint
370
375
)
371
376
372
377
def test_spec_nested_value_not_valid (self ):
@@ -381,9 +386,10 @@ class Invalid(models.Model):
381
386
assert (
382
387
"The value for 'bad' in 'spec.l1' is not an allowed type" in errors [0 ].msg
383
388
)
389
+ hint = errors [0 ].hint
390
+ assert hint is not None
384
391
assert (
385
- "'spec' values must be one of the following types: date, datetime"
386
- in errors [0 ].hint
392
+ "'spec' values must be one of the following types: date, datetime" in hint
387
393
)
388
394
389
395
0 commit comments