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
6a1fa4c8
Commit
6a1fa4c8
authored
Jan 16, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test optional slice arguments.
Add backwards compatibility test.
parent
abc67dd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
Lib/test/test_bisect.py
Lib/test/test_bisect.py
+14
-4
No files found.
Lib/test/test_bisect.py
View file @
6a1fa4c8
import
unittest
from
test
import
test_support
from
bisect
import
bisect_right
,
bisect_left
,
insort_left
,
insort_right
# XXX optional slice arguments need tests.
from
bisect
import
bisect_right
,
bisect_left
,
insort_left
,
insort_right
,
insort
,
bisect
class
TestBisect
(
unittest
.
TestCase
):
...
...
@@ -110,6 +107,16 @@ class TestBisect(unittest.TestCase):
if
ip
>
0
:
self
.
failUnless
(
data
[
ip
-
1
]
<=
elem
)
def
test_optionalSlicing
(
self
):
for
func
,
list
,
elt
,
expected
in
self
.
precomputedCases
:
lo
=
min
(
len
(
list
),
1
)
self
.
failUnless
(
func
(
list
,
elt
,
lo
=
lo
)
>=
lo
)
hi
=
min
(
len
(
list
),
2
)
self
.
failUnless
(
func
(
list
,
elt
,
hi
=
hi
)
<=
hi
)
def
test_backcompatibility
(
self
):
self
.
assertEqual
(
bisect
,
bisect_right
)
#==============================================================================
class
TestInsort
(
unittest
.
TestCase
):
...
...
@@ -131,6 +138,9 @@ class TestInsort(unittest.TestCase):
sorted
.
sort
()
self
.
assertEqual
(
sorted
,
insorted
)
def
test_backcompatibility
(
self
):
self
.
assertEqual
(
insort
,
insort_right
)
#==============================================================================
libreftest
=
"""
...
...
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