Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6a31b0fa
Commit
6a31b0fa
authored
Jan 02, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18829: Add tests for the csv module for invalid characters (delimiter,
escapechar, quotechar)
parent
5f8d4859
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
Lib/test/test_csv.py
Lib/test/test_csv.py
+13
-0
No files found.
Lib/test/test_csv.py
View file @
6a31b0fa
...
...
@@ -828,6 +828,19 @@ class TestDialectValidity(unittest.TestCase):
self
.
assertEqual
(
str
(
cm
.
exception
),
'"lineterminator" must be a string'
)
def
test_invalid_chars
(
self
):
def
create_invalid
(
field_name
,
value
):
class
mydialect
(
csv
.
Dialect
):
pass
setattr
(
mydialect
,
field_name
,
value
)
d
=
mydialect
()
for
field_name
in
(
"delimiter"
,
"escapechar"
,
"quotechar"
):
self
.
assertRaises
(
csv
.
Error
,
create_invalid
,
field_name
,
""
)
self
.
assertRaises
(
csv
.
Error
,
create_invalid
,
field_name
,
"abc"
)
self
.
assertRaises
(
csv
.
Error
,
create_invalid
,
field_name
,
b'x'
)
self
.
assertRaises
(
csv
.
Error
,
create_invalid
,
field_name
,
5
)
class
TestSniffer
(
unittest
.
TestCase
):
sample1
=
"""
\
...
...
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