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
5c53e608
Commit
5c53e608
authored
Jun 14, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some tests by deleting stuff.
parent
904c34db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
56 deletions
+1
-56
Lib/test/string_tests.py
Lib/test/string_tests.py
+0
-52
Lib/test/test_str.py
Lib/test/test_str.py
+0
-1
Lib/test/test_unicode.py
Lib/test/test_unicode.py
+1
-1
Lib/test/test_userstring.py
Lib/test/test_userstring.py
+0
-2
No files found.
Lib/test/string_tests.py
View file @
5c53e608
...
@@ -1096,58 +1096,6 @@ class MixinStrUnicodeUserStringTest:
...
@@ -1096,58 +1096,6 @@ class MixinStrUnicodeUserStringTest:
self
.
checkraises
(
TypeError
,
S
,
'rpartition'
,
None
)
self
.
checkraises
(
TypeError
,
S
,
'rpartition'
,
None
)
class
MixinStrStringUserStringTest
:
# Additional tests for 8bit strings, i.e. str, UserString and
# the string module
def
test_maketrans
(
self
):
self
.
assertEqual
(
''
.
join
(
map
(
chr
,
range
(
256
))).
replace
(
'abc'
,
'xyz'
),
string
.
maketrans
(
'abc'
,
'xyz'
)
)
self
.
assertRaises
(
ValueError
,
string
.
maketrans
,
'abc'
,
'xyzw'
)
def
test_translate
(
self
):
table
=
string
.
maketrans
(
'abc'
,
'xyz'
)
self
.
checkequal
(
'xyzxyz'
,
'xyzabcdef'
,
'translate'
,
table
,
'def'
)
table
=
string
.
maketrans
(
'a'
,
'A'
)
self
.
checkequal
(
'Abc'
,
'abc'
,
'translate'
,
table
)
self
.
checkequal
(
'xyz'
,
'xyz'
,
'translate'
,
table
)
self
.
checkequal
(
'yz'
,
'xyz'
,
'translate'
,
table
,
'x'
)
self
.
checkequal
(
'yx'
,
'zyzzx'
,
'translate'
,
None
,
'z'
)
self
.
checkequal
(
'zyzzx'
,
'zyzzx'
,
'translate'
,
None
,
''
)
self
.
checkequal
(
'zyzzx'
,
'zyzzx'
,
'translate'
,
None
)
self
.
checkraises
(
ValueError
,
'xyz'
,
'translate'
,
'too short'
,
'strip'
)
self
.
checkraises
(
ValueError
,
'xyz'
,
'translate'
,
'too short'
)
class
MixinStrUserStringTest
:
# Additional tests that only work with
# 8bit compatible object, i.e. str and UserString
def
test_encoding_decoding
(
self
):
codecs
=
[(
'rot13'
,
b'uryyb jbeyq'
),
(
'base64'
,
b'aGVsbG8gd29ybGQ=
\
n
'
),
(
'hex'
,
b'68656c6c6f20776f726c64'
),
(
'uu'
,
b'begin 666 <data>
\
n
+:&5L;&
\
\
@=V]R;&0
\
n
\
n
end
\
n
'
)]
for
encoding
,
data
in
codecs
:
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
encoding
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
encoding
)
# zlib is optional, so we make the test optional too...
try
:
import
zlib
except
ImportError
:
pass
else
:
data
=
b'x
\
x9c
\
xcb
H
\
xcd
\
xc9
\
xc9
W(
\
xcf
/
\
xca
I
\
x01
\
x00
\
x1a
\
x0b
\
x04
]'
self
.
checkequal
(
data
,
'hello world'
,
'encode'
,
'zlib'
)
self
.
checkequal
(
'hello world'
,
data
,
'decode'
,
'zlib'
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'decode'
,
42
)
self
.
checkraises
(
TypeError
,
'xyz'
,
'encode'
,
42
)
class
MixinStrUnicodeTest
:
class
MixinStrUnicodeTest
:
# Additional tests that only work with str and unicode.
# Additional tests that only work with str and unicode.
...
...
Lib/test/test_str.py
View file @
5c53e608
...
@@ -8,7 +8,6 @@ from test import test_support, string_tests
...
@@ -8,7 +8,6 @@ from test import test_support, string_tests
class
StrTest
(
class
StrTest
(
string_tests
.
CommonTest
,
string_tests
.
CommonTest
,
string_tests
.
MixinStrUnicodeUserStringTest
,
string_tests
.
MixinStrUnicodeUserStringTest
,
string_tests
.
MixinStrUserStringTest
,
string_tests
.
MixinStrUnicodeTest
,
string_tests
.
MixinStrUnicodeTest
,
):
):
...
...
Lib/test/test_unicode.py
View file @
5c53e608
...
@@ -791,7 +791,7 @@ class UnicodeTest(
...
@@ -791,7 +791,7 @@ class UnicodeTest(
# to take a 64-bit long, this test should apply to all platforms.
# to take a 64-bit long, this test should apply to all platforms.
if sys.maxint > (1 << 32) or struct.calcsize('
P
') != 4:
if sys.maxint > (1 << 32) or struct.calcsize('
P
') != 4:
return
return
self.assertRaises(OverflowError,
u
'
t
\
tt
\
t
'.expandtabs, sys.maxint)
self.assertRaises(OverflowError, '
t
\
tt
\
t
'.expandtabs, sys.maxint)
def test_main():
def test_main():
...
...
Lib/test/test_userstring.py
View file @
5c53e608
...
@@ -10,8 +10,6 @@ from UserString import UserString, MutableString
...
@@ -10,8 +10,6 @@ from UserString import UserString, MutableString
class
UserStringTest
(
class
UserStringTest
(
string_tests
.
CommonTest
,
string_tests
.
CommonTest
,
string_tests
.
MixinStrUnicodeUserStringTest
,
string_tests
.
MixinStrUnicodeUserStringTest
,
string_tests
.
MixinStrStringUserStringTest
,
string_tests
.
MixinStrUserStringTest
):
):
type2test
=
UserString
type2test
=
UserString
...
...
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