PHP 8.2.30
Preview: test_shouldraise.py Size: 628 B
//opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/tests/test_django/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")

Directory Contents

Dirs: 1 × Files: 6

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
273 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
250 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
261 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.86 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
628 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
0 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).