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
a2f93885
Commit
a2f93885
authored
Sep 28, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.4 (#22379)
parents
c081262b
c31f12d1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
15 deletions
+13
-15
Lib/test/string_tests.py
Lib/test/string_tests.py
+6
-8
Lib/test/test_bytes.py
Lib/test/test_bytes.py
+1
-0
Lib/test/test_userstring.py
Lib/test/test_userstring.py
+5
-7
Misc/ACKS
Misc/ACKS
+1
-0
No files found.
Lib/test/string_tests.py
View file @
a2f93885
"""
Common tests shared by test_
str, test_
unicode, test_userstring and test_string.
Common tests shared by test_unicode, test_userstring and test_string.
"""
import
unittest
,
string
,
sys
,
struct
...
...
@@ -79,11 +79,9 @@ class BaseTest:
def
checkraises
(
self
,
exc
,
obj
,
methodname
,
*
args
):
obj
=
self
.
fixtype
(
obj
)
args
=
self
.
fixtype
(
args
)
self
.
assertRaises
(
exc
,
getattr
(
obj
,
methodname
),
*
args
)
with
self
.
assertRaises
(
exc
)
as
cm
:
getattr
(
obj
,
methodname
)(
*
args
)
self
.
assertNotEqual
(
str
(
cm
.
exception
),
''
)
# call obj.method(*args) without any checks
def
checkcall
(
self
,
obj
,
methodname
,
*
args
):
...
...
@@ -1119,8 +1117,7 @@ class MixinStrUnicodeUserStringTest:
def
test_join
(
self
):
# join now works with any sequence type
# moved here, because the argument order is
# different in string.join (see the test in
# test.test_string.StringTest.test_join)
# different in string.join
self
.
checkequal
(
'a b c d'
,
' '
,
'join'
,
[
'a'
,
'b'
,
'c'
,
'd'
])
self
.
checkequal
(
'abcd'
,
''
,
'join'
,
(
'a'
,
'b'
,
'c'
,
'd'
))
self
.
checkequal
(
'bd'
,
''
,
'join'
,
(
''
,
'b'
,
''
,
'd'
))
...
...
@@ -1140,6 +1137,7 @@ class MixinStrUnicodeUserStringTest:
self
.
checkequal
(
'a b c'
,
' '
,
'join'
,
BadSeq2
())
self
.
checkraises
(
TypeError
,
' '
,
'join'
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
None
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
7
)
self
.
checkraises
(
TypeError
,
' '
,
'join'
,
[
1
,
2
,
bytes
()])
try
:
...
...
Lib/test/test_bytes.py
View file @
a2f93885
...
...
@@ -298,6 +298,7 @@ class BaseBytesTest:
seq
=
[
b"abc"
]
*
1000
expected
=
b"abc"
+
b".:abc"
*
999
self
.
assertEqual
(
dot_join
(
seq
),
expected
)
self
.
assertRaises
(
TypeError
,
self
.
type2test
(
b" "
).
join
,
None
)
# Error handling and cleanup when some item in the middle of the
# sequence has the wrong type.
with
self
.
assertRaises
(
TypeError
):
...
...
Lib/test/test_userstring.py
View file @
a2f93885
...
...
@@ -28,14 +28,12 @@ class UserStringTest(
realresult
)
def
checkraises
(
self
,
exc
,
obj
ect
,
methodname
,
*
args
):
obj
ect
=
self
.
fixtype
(
object
)
def
checkraises
(
self
,
exc
,
obj
,
methodname
,
*
args
):
obj
=
self
.
fixtype
(
obj
)
# we don't fix the arguments, because UserString can't cope with it
self
.
assertRaises
(
exc
,
getattr
(
object
,
methodname
),
*
args
)
with
self
.
assertRaises
(
exc
)
as
cm
:
getattr
(
obj
,
methodname
)(
*
args
)
self
.
assertNotEqual
(
str
(
cm
.
exception
),
''
)
def
checkcall
(
self
,
object
,
methodname
,
*
args
):
object
=
self
.
fixtype
(
object
)
...
...
Misc/ACKS
View file @
a2f93885
...
...
@@ -1019,6 +1019,7 @@ Mike Pall
Todd R. Palmer
Juan David Ibáñez Palomar
Jan Palus
Yongzhi Pan
Martin Panter
Mathias Panzenböck
M. Papillon
...
...
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