FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
validators/tests/test_domain.py at master · pythonthings/validators · GitHub
pythonthings
validators
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
validators
/
tests
/
test_domain.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (30 loc) · 778 Bytes
Breadcrumbs
validators
/
tests
/
test_domain.py
Copy path
File metadata and controls
35 lines (30 loc) · 778 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
import
pytest
from
validators
import
domain
,
ValidationFailure
@
pytest
.
mark
.
parametrize
(
'value'
, [
'example.com'
,
'xn----gtbspbbmkef.xn--p1ai'
,
'underscore_subdomain.example.com'
,
'something.versicherung'
,
'11.com'
,
'3.cn'
,
'a.cn'
,
'sub1.sub2.sample.co.uk'
,
'somerandomexample.xn--fiqs8s'
])
def
test_returns_true_on_valid_domain
(
value
):
assert
domain
(
value
)
@
pytest
.
mark
.
parametrize
(
'value'
, [
'example.com/'
,
'example.com:4444'
,
'example.-com'
,
'example.'
,
'-example.com'
,
'example-.com'
,
'_example.com'
,
'example_.com'
,
'example'
,
'a......b.com'
])
def
test_returns_failed_validation_on_invalid_domain
(
value
):
assert
isinstance
(
domain
(
value
),
ValidationFailure
)
Back
|
FazBrowse Home
|
New Git URL