mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-24 20:48:31 -07:00
Upstream make use of some Pytest-specific functionality. We adjust the patch accordingly. Package-Manager: Portage-3.0.1, Repoman-2.3.23 Signed-off-by: Sam James <sam@gentoo.org>
41 lines
1.5 KiB
Diff
41 lines
1.5 KiB
Diff
diff --git a/tests/test_validate.py b/tests/test_validate.py
|
|
index bffb0dc..c7d57d3 100644
|
|
--- a/tests/test_validate.py
|
|
+++ b/tests/test_validate.py
|
|
@@ -2,7 +2,7 @@
|
|
|
|
from configobj import ConfigObj
|
|
import pytest
|
|
-from validate import Validator, VdtValueTooSmallError
|
|
+from validate import Validator, VdtValueTooSmallError, dottedQuadToNum
|
|
|
|
|
|
class TestBasic(object):
|
|
@@ -161,3 +161,26 @@ class TestBasic(object):
|
|
'test3': 3,
|
|
'test4': 6.0
|
|
}}}
|
|
+
|
|
+
|
|
+class TestDottedQuadToNum(object):
|
|
+
|
|
+ def test_stripped(self):
|
|
+ assert dottedQuadToNum('192.0.2.0') == 3221225984
|
|
+ assert dottedQuadToNum('192.0.2.1 ') == 3221225985
|
|
+ assert dottedQuadToNum(' 192.0.2.2') == 3221225986
|
|
+ assert dottedQuadToNum('\t\t192.0.2.3\n') == 3221225987
|
|
+ with pytest.raises(ValueError) as excinfo:
|
|
+ dottedQuadToNum('192. 0. 2. 4')
|
|
+ assert str(excinfo.value) == 'Not a good dotted-quad IP: 192. 0. 2. 4'
|
|
+
|
|
+ def test_boundaries(self):
|
|
+ assert dottedQuadToNum('0.0.0.0') == 0
|
|
+ assert dottedQuadToNum('255.255.255.255') == 4294967295
|
|
+ with pytest.raises(ValueError) as excinfo:
|
|
+ dottedQuadToNum('255.255.255.256')
|
|
+ assert str(excinfo.value) == (
|
|
+ 'Not a good dotted-quad IP: 255.255.255.256')
|
|
+ with pytest.raises(ValueError) as excinfo:
|
|
+ dottedQuadToNum('-1')
|
|
+ assert str(excinfo.value) == 'Not a good dotted-quad IP: -1'
|