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
5c75235d
Commit
5c75235d
authored
Aug 03, 2010
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation warnings in test_set.py
parent
ffd0b889
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
Lib/test/test_set.py
Lib/test/test_set.py
+13
-8
No files found.
Lib/test/test_set.py
View file @
5c75235d
...
@@ -1385,8 +1385,9 @@ class TestCopying(unittest.TestCase):
...
@@ -1385,8 +1385,9 @@ class TestCopying(unittest.TestCase):
def
test_copy
(
self
):
def
test_copy
(
self
):
dup
=
self
.
set
.
copy
()
dup
=
self
.
set
.
copy
()
dup_list
=
list
(
dup
);
dup_list
.
sort
()
with
test_support
.
check_warnings
():
set_list
=
list
(
self
.
set
);
set_list
.
sort
()
dup_list
=
sorted
(
dup
)
set_list
=
sorted
(
self
.
set
)
self
.
assertEqual
(
len
(
dup_list
),
len
(
set_list
))
self
.
assertEqual
(
len
(
dup_list
),
len
(
set_list
))
for
i
in
range
(
len
(
dup_list
)):
for
i
in
range
(
len
(
dup_list
)):
self
.
failUnless
(
dup_list
[
i
]
is
set_list
[
i
])
self
.
failUnless
(
dup_list
[
i
]
is
set_list
[
i
])
...
@@ -1394,8 +1395,9 @@ class TestCopying(unittest.TestCase):
...
@@ -1394,8 +1395,9 @@ class TestCopying(unittest.TestCase):
def
test_deep_copy
(
self
):
def
test_deep_copy
(
self
):
dup
=
copy
.
deepcopy
(
self
.
set
)
dup
=
copy
.
deepcopy
(
self
.
set
)
##print type(dup), repr(dup)
##print type(dup), repr(dup)
dup_list
=
list
(
dup
);
dup_list
.
sort
()
with
test_support
.
check_warnings
():
set_list
=
list
(
self
.
set
);
set_list
.
sort
()
dup_list
=
sorted
(
dup
)
set_list
=
sorted
(
self
.
set
)
self
.
assertEqual
(
len
(
dup_list
),
len
(
set_list
))
self
.
assertEqual
(
len
(
dup_list
),
len
(
set_list
))
for
i
in
range
(
len
(
dup_list
)):
for
i
in
range
(
len
(
dup_list
)):
self
.
assertEqual
(
dup_list
[
i
],
set_list
[
i
])
self
.
assertEqual
(
dup_list
[
i
],
set_list
[
i
])
...
@@ -1557,8 +1559,9 @@ class TestVariousIteratorArgs(unittest.TestCase):
...
@@ -1557,8 +1559,9 @@ class TestVariousIteratorArgs(unittest.TestCase):
def
test_constructor
(
self
):
def
test_constructor
(
self
):
for
cons
in
(
set
,
frozenset
):
for
cons
in
(
set
,
frozenset
):
for
s
in
(
"123"
,
""
,
range
(
1000
),
(
'do'
,
1.2
),
xrange
(
2000
,
2200
,
5
)):
for
s
in
(
"123"
,
""
,
range
(
1000
),
(
'do'
,
1.2
),
xrange
(
2000
,
2200
,
5
)):
for
g
in
(
G
,
I
,
Ig
,
S
,
L
,
R
):
with
test_support
.
check_warnings
():
self
.
assertEqual
(
sorted
(
cons
(
g
(
s
))),
sorted
(
g
(
s
)))
for
g
in
(
G
,
I
,
Ig
,
S
,
L
,
R
):
self
.
assertEqual
(
sorted
(
cons
(
g
(
s
))),
sorted
(
g
(
s
)))
self
.
assertRaises
(
TypeError
,
cons
,
X
(
s
))
self
.
assertRaises
(
TypeError
,
cons
,
X
(
s
))
self
.
assertRaises
(
TypeError
,
cons
,
N
(
s
))
self
.
assertRaises
(
TypeError
,
cons
,
N
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
cons
,
E
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
cons
,
E
(
s
))
...
@@ -1573,7 +1576,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
...
@@ -1573,7 +1576,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
if
isinstance
(
expected
,
bool
):
if
isinstance
(
expected
,
bool
):
self
.
assertEqual
(
actual
,
expected
)
self
.
assertEqual
(
actual
,
expected
)
else
:
else
:
self
.
assertEqual
(
sorted
(
actual
),
sorted
(
expected
))
with
test_support
.
check_warnings
():
self
.
assertEqual
(
sorted
(
actual
),
sorted
(
expected
))
self
.
assertRaises
(
TypeError
,
meth
,
X
(
s
))
self
.
assertRaises
(
TypeError
,
meth
,
X
(
s
))
self
.
assertRaises
(
TypeError
,
meth
,
N
(
s
))
self
.
assertRaises
(
TypeError
,
meth
,
N
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
meth
,
E
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
meth
,
E
(
s
))
...
@@ -1587,7 +1591,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
...
@@ -1587,7 +1591,8 @@ class TestVariousIteratorArgs(unittest.TestCase):
t
=
s
.
copy
()
t
=
s
.
copy
()
getattr
(
s
,
methname
)(
list
(
g
(
data
)))
getattr
(
s
,
methname
)(
list
(
g
(
data
)))
getattr
(
t
,
methname
)(
g
(
data
))
getattr
(
t
,
methname
)(
g
(
data
))
self
.
assertEqual
(
sorted
(
s
),
sorted
(
t
))
with
test_support
.
check_warnings
():
self
.
assertEqual
(
sorted
(
s
),
sorted
(
t
))
self
.
assertRaises
(
TypeError
,
getattr
(
set
(
'january'
),
methname
),
X
(
data
))
self
.
assertRaises
(
TypeError
,
getattr
(
set
(
'january'
),
methname
),
X
(
data
))
self
.
assertRaises
(
TypeError
,
getattr
(
set
(
'january'
),
methname
),
N
(
data
))
self
.
assertRaises
(
TypeError
,
getattr
(
set
(
'january'
),
methname
),
N
(
data
))
...
...
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