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
1546bc43
Commit
1546bc43
authored
Jun 12, 2003
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a couple test cases which involve longs and floats in 'e' format.
parent
28a4f0f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
Lib/test/test_csv.py
Lib/test/test_csv.py
+23
-0
No files found.
Lib/test/test_csv.py
View file @
1546bc43
...
...
@@ -423,6 +423,21 @@ class TestDictFields(unittest.TestCase):
"4"
:
'DEFAULT'
,
"5"
:
'DEFAULT'
,
"6"
:
'DEFAULT'
})
def
test_read_multi
(
self
):
sample
=
[
'2147483648,43.0e12,17,abc,def
\
r
\
n
'
,
'147483648,43.0e2,17,abc,def
\
r
\
n
'
,
'47483648,43.0,170,abc,def
\
r
\
n
'
]
reader
=
csv
.
DictReader
(
sample
,
fieldnames
=
"i1 float i2 s1 s2"
.
split
())
self
.
assertEqual
(
reader
.
next
(),
{
"i1"
:
'2147483648'
,
"float"
:
'43.0e12'
,
"i2"
:
'17'
,
"s1"
:
'abc'
,
"s2"
:
'def'
})
def
test_read_with_blanks
(
self
):
reader
=
csv
.
DictReader
([
"1,2,abc,4,5,6
\
r
\
n
"
,
"
\
r
\
n
"
,
"1,2,abc,4,5,6
\
r
\
n
"
],
...
...
@@ -555,6 +570,12 @@ Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back
05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
'''
sample4
=
'''
\
2147483648;43.0e12;17;abc;def
147483648;43.0e2;17;abc;def
47483648;43.0;170;abc;def
'''
def
test_has_header
(
self
):
...
...
@@ -582,6 +603,8 @@ Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back
self
.
assertEqual
(
dialect
.
delimiter
,
"?"
)
dialect
=
sniffer
.
sniff
(
self
.
sample3
,
delimiters
=
"/,"
)
self
.
assertEqual
(
dialect
.
delimiter
,
"/"
)
dialect
=
sniffer
.
sniff
(
self
.
sample4
)
self
.
assertEqual
(
dialect
.
delimiter
,
";"
)
if
not
hasattr
(
sys
,
"gettotalrefcount"
):
if
test_support
.
verbose
:
print
"*** skipping leakage tests ***"
...
...
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