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
99276225
Commit
99276225
authored
Jun 14, 2016
by
Berker Peksag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace more boilerplate code with modern unittest features in sqlite3 tests
parent
b3494103
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
13 deletions
+6
-13
Lib/sqlite3/test/dbapi.py
Lib/sqlite3/test/dbapi.py
+1
-2
Lib/sqlite3/test/hooks.py
Lib/sqlite3/test/hooks.py
+2
-2
Lib/sqlite3/test/regression.py
Lib/sqlite3/test/regression.py
+3
-9
No files found.
Lib/sqlite3/test/dbapi.py
View file @
99276225
...
...
@@ -335,8 +335,7 @@ class CursorTests(unittest.TestCase):
def
CheckTotalChanges
(
self
):
self
.
cu
.
execute
(
"insert into test(name) values ('foo')"
)
self
.
cu
.
execute
(
"insert into test(name) values ('foo')"
)
if
self
.
cx
.
total_changes
<
2
:
self
.
fail
(
"total changes reported wrong value"
)
self
.
assertLess
(
2
,
self
.
cx
.
total_changes
,
msg
=
'total changes reported wrong value'
)
# Checks for executemany:
# Sequences are required by the DB-API, iterators
...
...
Lib/sqlite3/test/hooks.py
View file @
99276225
...
...
@@ -61,8 +61,8 @@ class CollationTests(unittest.TestCase):
) order by x collate mycoll
"""
result
=
con
.
execute
(
sql
).
fetchall
()
if
result
[
0
][
0
]
!=
"c"
or
result
[
1
][
0
]
!=
"b"
or
result
[
2
][
0
]
!=
"a"
:
self
.
fail
(
"the expected order was not returned"
)
self
.
assertEqual
(
result
,
[(
'c'
,),
(
'b'
,),
(
'a'
,)],
msg
=
'the expected order was not returned'
)
con
.
create_collation
(
"mycoll"
,
None
)
with
self
.
assertRaises
(
sqlite
.
OperationalError
)
as
cm
:
...
...
Lib/sqlite3/test/regression.py
View file @
99276225
...
...
@@ -134,17 +134,11 @@ class RegressionTests(unittest.TestCase):
def
CheckErrorMsgDecodeError
(
self
):
# When porting the module to Python 3.0, the error message about
# decoding errors disappeared. This verifies they're back again.
failure
=
None
try
:
with
self
.
assertRaises
(
sqlite
.
OperationalError
)
as
cm
:
self
.
con
.
execute
(
"select 'xxx' || ? || 'yyy' colname"
,
(
bytes
(
bytearray
([
250
])),)).
fetchone
()
failure
=
"should have raised an OperationalError with detailed description"
except
sqlite
.
OperationalError
as
e
:
msg
=
e
.
args
[
0
]
if
not
msg
.
startswith
(
"Could not decode to UTF-8 column 'colname' with text 'xxx"
):
failure
=
"OperationalError did not have expected description text"
if
failure
:
self
.
fail
(
failure
)
msg
=
"Could not decode to UTF-8 column 'colname' with text 'xxx"
self
.
assertIn
(
msg
,
str
(
cm
.
exception
))
def
CheckRegisterAdapter
(
self
):
"""
...
...
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