golden hour
/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/tests/test_django
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.py
0 B
Del
OK
__pycache__
-
Del
OK
manage.py
273 B
Del
OK
models.py
250 B
Del
OK
settings.py
261 B
Del
OK
test_compare.py
2.86 KB
Del
OK
test_shouldraise.py
628 B
Del
OK
Edit: test_shouldraise.py
from django.core.exceptions import ValidationError from testfixtures import ShouldRaise from testfixtures.shouldraise import ShouldAssert class TestShouldRaiseWithValidatorErrors(object): def test_as_expected(self): with ShouldRaise(ValidationError("d'oh")): raise ValidationError("d'oh") def test_not_as_expected(self): message = ( 'ValidationError(["d\'oh"]) (expected) != ' 'ValidationError([\'nuts\']) (raised)' ) with ShouldAssert(message): with ShouldRaise(ValidationError("d'oh")): raise ValidationError("nuts")
Save