FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
validators/tests/test_encoding.py at 0.28.3 · python-validators/validators · GitHub
python-validators
validators
Repository navigation
Code
Issues
6
(6)
Pull requests
34
(34)
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
validators
/
tests
/
test_encoding.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (40 loc) · 1.36 KB
Breadcrumbs
validators
/
tests
/
test_encoding.py
Copy path
File metadata and controls
53 lines (40 loc) · 1.36 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Test Encodings."""
# external
import
pytest
# local
from
validators
import
ValidationError
,
base58
,
base64
# ==> base58 <== #
@
pytest
.
mark
.
parametrize
(
"value"
,
[
"cUSECaVvAiV3srWbFRvVPzm5YzcXJwPSwZfE7veYPHoXmR9h6YMQ"
,
"18KToMF5ckjXBYt2HAj77qsG3GPeej3PZn"
,
"n4FFXRNNEW1aA2WPscSuzHTCjzjs4TVE2Z"
,
"38XzQ9dPGb1uqbZsjPtUajp7omy8aefjqj"
,
],
)
def
test_returns_true_on_valid_base58
(
value
:
str
):
"""Test returns true on valid base58."""
assert
base58
(
value
)
@
pytest
.
mark
.
parametrize
(
"value"
,
[
"ThisIsAReallyLongStringThatIsDefinitelyNotBase58Encoded"
,
"abcABC!@#"
,
"InvalidBase58!"
],
)
def
test_returns_failed_validation_on_invalid_base58
(
value
:
str
):
"""Test returns failed validation on invalid base58."""
assert
isinstance
(
base58
(
value
),
ValidationError
)
# ==> base64 <== #
@
pytest
.
mark
.
parametrize
(
"value"
,
[
"SGVsbG8gV29ybGQ="
,
"U29tZSBkYXRhIHN0cmluZw=="
,
"YW55IGNhcm5hbCBwbGVhcw=="
],
)
def
test_returns_true_on_valid_base64
(
value
:
str
):
"""Test returns true on valid base64."""
assert
base64
(
value
)
@
pytest
.
mark
.
parametrize
(
"value"
,
[
"SGVsbG8gV29ybGQ"
,
"U29tZSBkYXRhIHN0cmluZw"
,
"YW55IGNhcm5hbCBwbGVhc"
],
)
def
test_returns_failed_validation_on_invalid_base64
(
value
:
str
):
"""Test returns failed validation on invalid base64."""
assert
isinstance
(
base64
(
value
),
ValidationError
)
Back
|
FazBrowse Home
|
New Git URL