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
7f1d3aa3
Commit
7f1d3aa3
authored
Jul 16, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for array self-assigns. (This one has no relevance to JPython.)
parent
affd77f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
Lib/test/test_array.py
Lib/test/test_array.py
+28
-1
No files found.
Lib/test/test_array.py
View file @
7f1d3aa3
...
...
@@ -3,7 +3,7 @@
Roger E. Masse
"""
import
array
from
test_support
import
verbose
,
TESTFN
,
unlink
from
test_support
import
verbose
,
TESTFN
,
unlink
,
TestFailed
def
main
():
...
...
@@ -54,6 +54,33 @@ def testtype(type, example):
print
'array of %s converted to a string: '
\
%
a
.
typecode
,
`a.tostring()`
if
type
==
'c'
:
a
=
array
.
array
(
type
,
"abcde"
)
a
[:
-
1
]
=
a
if
a
!=
array
.
array
(
type
,
"abcdee"
):
raise
TestFailed
,
"array(%s) self-slice-assign (head)"
%
`type`
a
=
array
.
array
(
type
,
"abcde"
)
a
[
1
:]
=
a
if
a
!=
array
.
array
(
type
,
"aabcde"
):
raise
TestFailed
,
"array(%s) self-slice-assign (tail)"
%
`type`
a
=
array
.
array
(
type
,
"abcde"
)
a
[
1
:
-
1
]
=
a
if
a
!=
array
.
array
(
type
,
"aabcdee"
):
raise
TestFailed
,
"array(%s) self-slice-assign (cntr)"
%
`type`
else
:
a
=
array
.
array
(
type
,
[
1
,
2
,
3
,
4
,
5
])
a
[:
-
1
]
=
a
if
a
!=
array
.
array
(
type
,
[
1
,
2
,
3
,
4
,
5
,
5
]):
raise
TestFailed
,
"array(%s) self-slice-assign (head)"
%
`type`
a
=
array
.
array
(
type
,
[
1
,
2
,
3
,
4
,
5
])
a
[
1
:]
=
a
if
a
!=
array
.
array
(
type
,
[
1
,
1
,
2
,
3
,
4
,
5
]):
raise
TestFailed
,
"array(%s) self-slice-assign (tail)"
%
`type`
a
=
array
.
array
(
type
,
[
1
,
2
,
3
,
4
,
5
])
a
[
1
:
-
1
]
=
a
if
a
!=
array
.
array
(
type
,
[
1
,
1
,
2
,
3
,
4
,
5
,
5
]):
raise
TestFailed
,
"array(%s) self-slice-assign (cntr)"
%
`type`
main
()
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