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