Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
dfe79c77
Commit
dfe79c77
authored
Dec 27, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7e9771cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
software/ors-amarisoft/ru/xbuildout.py
software/ors-amarisoft/ru/xbuildout.py
+27
-5
No files found.
software/ors-amarisoft/ru/xbuildout.py
View file @
dfe79c77
...
...
@@ -56,7 +56,7 @@ def decode(s: str): # -> str | ValueError
try
:
return
_decode
(
s
)
except
Exception
as
e
:
raise
ValueError
(
"
decoding
%r"
%
s
)
from
e
raise
ValueError
(
"
invalid encoding:
%r"
%
s
)
from
e
def
_decode
(
s
):
s
=
s
.
encode
(
'utf-8'
)
...
...
@@ -127,7 +127,29 @@ def test_encode():
assert
encode
(
s
)
==
encok
assert
decode
(
encok
)
==
s
# XXX decode error
# XXX UTF-8 error
# decode errors
from
pytest
import
raises
def
checkbad
(
x
,
f
):
with
raises
(
ValueError
,
match
=
"invalid encoding"
)
as
exci
:
decode
(
x
)
cause
=
exci
.
value
.
__cause__
f
(
cause
)
for
x
in
(
'_'
,
'_1'
,
'a_2'
):
def
_
(
cause
):
assert
isinstance
(
cause
,
ValueError
)
assert
cause
.
args
==
(
"truncated escape sequence"
,)
checkbad
(
x
,
_
)
for
x
in
(
'_1r'
,
'_r1'
,
'a_xy'
):
def
_
(
cause
):
assert
isinstance
(
cause
,
ValueError
)
assert
len
(
cause
.
args
)
==
1
assert
cause
.
args
[
0
]
.
startswith
(
"invalid literal for int() with base 16:"
)
checkbad
(
x
,
_
)
for
x
in
(
'_c3_28'
,
'_e2_28_a1'
):
def
_
(
cause
):
assert
isinstance
(
cause
,
UnicodeDecodeError
)
checkbad
(
x
,
_
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment