Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-pytoml
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-pytoml
Commits
23afb8a9
Commit
23afb8a9
authored
7 years ago
by
Michael Williamson
Browse files
Options
Downloads
Patches
Plain Diff
Test filename is included in parse errors
parent
0495b019
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_parser.py
+24
-0
24 additions, 0 deletions
test/test_parser.py
with
24 additions
and
0 deletions
test/test_parser.py
0 → 100644
+
24
−
0
View file @
23afb8a9
from
__future__
import
unicode_literals
import
sys
if
sys
.
version_info
<
(
2
,
7
):
from
StringIO
import
StringIO
else
:
from
io
import
StringIO
import
pytest
import
pytoml
as
toml
def
test_name_of_fileobj_is_used_in_errors
():
source
=
StringIO
(
"
[
"
)
source
.
name
=
"
<source>
"
error
=
pytest
.
raises
(
toml
.
TomlError
,
lambda
:
toml
.
load
(
source
))
assert
error
.
value
.
filename
==
"
<source>
"
def
test_when_fileobj_has_no_name_attr_then_repr_of_fileobj_is_used_in_errors
():
source
=
StringIO
(
"
[
"
)
error
=
pytest
.
raises
(
toml
.
TomlError
,
lambda
:
toml
.
load
(
source
))
assert
error
.
value
.
filename
==
repr
(
source
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment