File: test_validation_failure.py

package info (click to toggle)
validators 0.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 332 kB
  • sloc: python: 1,556; makefile: 150
file content (25 lines) | stat: -rw-r--r-- 583 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import validators

obj_repr = (
    "ValidationFailure(func=between"
)


class TestValidationFailure(object):
    def setup_method(self, method):
        self.obj = validators.between(3, min=4, max=5)

    def test_boolean_coerce(self):
        assert not bool(self.obj)
        assert not self.obj

    def test_repr(self):
        assert obj_repr in repr(self.obj)

    def test_unicode(self):
        assert obj_repr in str(self.obj)

    def test_arguments_as_properties(self):
        assert self.obj.value == 3
        assert self.obj.min == 4
        assert self.obj.max == 5