Skip to content

Commit bd29a3a

Browse files
committed
Renamed range tests
1 parent 0291b23 commit bd29a3a

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎tests/test_range.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
import pytest
3+
import validators
4+
5+
6+
@pytest.mark.parametrize(('value', 'min', 'max'), [
7+
(12, 11, 13),
8+
(12, None, 14),
9+
(12, 11, None),
10+
(12, 12, 12)
11+
])
12+
def test_returns_true_on_valid_range(value, min, max):
13+
assert validators.range(value, min=min, max=max)
14+
15+
16+
@pytest.mark.parametrize(('value', 'min', 'max'), [
17+
(12, 13, 12),
18+
(12, None, None),
19+
])
20+
def test_raises_assertion_error_for_invalid_args(value, min, max):
21+
with pytest.raises(AssertionError):
22+
assert validators.range(value, min=min, max=max)
23+
24+
25+
@pytest.mark.parametrize(('value', 'min', 'max'), [
26+
(12, 13, 14),
27+
(12, None, 11),
28+
(12, 13, None)
29+
])
30+
def test_returns_failed_validation_on_invalid_range(value, min, max):
31+
result = validators.range(value, min=min, max=max)
32+
assert isinstance(result, validators.ValidationFailure)

0 commit comments

Comments
 (0)