Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
eigenpy
Commits
cc30e464
Unverified
Commit
cc30e464
authored
1 year ago
by
Joris Vaillant
Browse files
Options
Downloads
Patches
Plain Diff
[std-array] Test array edge cases
parent
6ad64487
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#33673
passed with warnings
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittest/python/test_std_array.py
+89
-0
89 additions, 0 deletions
unittest/python/test_std_array.py
with
89 additions
and
0 deletions
unittest/python/test_std_array.py
+
89
−
0
View file @
cc30e464
...
...
@@ -18,6 +18,95 @@ assert len(_ints_slice) == 2, "Slice size should be 1, got %d" % len(_ints_slice
assert
_ints_slice
[
0
]
==
2
assert
_ints_slice
[
1
]
==
3
# Test that insert/delete is impossible with the slice operator
# prepend
try
:
ints
[
0
:
0
]
=
[
0
,
1
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
Insert value with slice operator should be impossible
"
# append
try
:
ints
[
10
:
12
]
=
[
0
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
Insert value with slice operator should be impossible
"
# append
try
:
ints
[
3
:
3
]
=
[
0
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
Insert value with slice operator should be impossible
"
# Erase two elements and replace by one
try
:
ints
[
1
:
3
]
=
[
0
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
Insert value with slice operator should be impossible
"
# Erase two elements and replace by three
try
:
ints
[
1
:
3
]
=
[
0
,
1
,
2
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
Insert value with slice operator should be impossible
"
# Test that delete operator is not implemented
# Index delete
try
:
del
ints
[
0
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
del is not implemented
"
# Slice delete
try
:
del
ints
[
1
:
3
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
del is not implemented
"
# Slice delete
try
:
del
ints
[
1
:
3
]
except
NotImplementedError
:
pass
else
:
assert
False
,
"
del is not implemented
"
# Test that append/extend are not implemented
# append
try
:
ints
.
append
(
4
)
except
AttributeError
:
pass
else
:
assert
False
,
"
append is not implemented
"
# extend
try
:
ints
.
extend
([
4
,
5
])
except
AttributeError
:
pass
else
:
assert
False
,
"
extend is not implemented
"
# Test set_slice nominal case
ints
[
1
:
3
]
=
[
10
,
20
]
assert
ints
[
1
]
==
10
assert
ints
[
2
]
==
20
# print(ints.tolist())
vecs
=
std_array
.
get_arr_3_vecs
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment