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
8cc859c1
Commit
8cc859c1
authored
Mar 06, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26167: Backported copy tests.
parent
aabafe7b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
6 deletions
+49
-6
Lib/test/test_copy.py
Lib/test/test_copy.py
+49
-6
No files found.
Lib/test/test_copy.py
View file @
8cc859c1
...
...
@@ -95,24 +95,67 @@ class TestCopy(unittest.TestCase):
pass
class
WithMetaclass
(
metaclass
=
abc
.
ABCMeta
):
pass
tests
=
[
None
,
42
,
2
**
100
,
3.14
,
True
,
False
,
1j
,
tests
=
[
None
,
...,
NotImplemented
,
42
,
2
**
100
,
3.14
,
True
,
False
,
1j
,
"hello"
,
"hello
\
u1234
"
,
f
.
__code__
,
b"world"
,
bytes
(
range
(
256
)),
NewStyle
,
range
(
10
),
Classic
,
max
,
WithMetaclass
]
b"world"
,
bytes
(
range
(
256
)),
range
(
10
),
NewStyle
,
Classic
,
max
,
WithMetaclass
]
for
x
in
tests
:
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
def
test_copy_list
(
self
):
x
=
[
1
,
2
,
3
]
self
.
assertEqual
(
copy
.
copy
(
x
),
x
)
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
x
=
[]
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
def
test_copy_tuple
(
self
):
x
=
(
1
,
2
,
3
)
self
.
assertEqual
(
copy
.
copy
(
x
),
x
)
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
x
=
()
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
x
=
(
1
,
2
,
3
,
[])
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
def
test_copy_dict
(
self
):
x
=
{
"foo"
:
1
,
"bar"
:
2
}
self
.
assertEqual
(
copy
.
copy
(
x
),
x
)
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
x
=
{}
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
def
test_copy_set
(
self
):
x
=
{
1
,
2
,
3
}
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
x
=
set
()
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
def
test_copy_frozenset
(
self
):
x
=
frozenset
({
1
,
2
,
3
})
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
x
=
frozenset
()
self
.
assertIs
(
copy
.
copy
(
x
),
x
)
def
test_copy_bytearray
(
self
):
x
=
bytearray
(
b'abc'
)
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
x
=
bytearray
()
y
=
copy
.
copy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
def
test_copy_inst_vanilla
(
self
):
class
C
:
...
...
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