Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
lscsoft
ligo-segments
Commits
37e19aa6
Commit
37e19aa6
authored
Jul 04, 2018
by
Duncan Macleod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'python3-cmp' into 'master'"
This reverts merge request
!4
parent
8af238a7
Pipeline
#24299
passed with stages
in 8 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
28 deletions
+12
-28
ligo/segments.py
ligo/segments.py
+12
-17
test/segments_verify.py
test/segments_verify.py
+0
-11
No files found.
ligo/segments.py
View file @
37e19aa6
...
...
@@ -137,23 +137,18 @@ class infinity(object):
# tests
def
__lt__
(
self
,
other
):
return
self
is
NegInfinity
and
other
is
not
NegInfinity
def
__gt__
(
self
,
other
):
return
self
is
PosInfinity
and
other
is
not
PosInfinity
def
__le__
(
self
,
other
):
return
self
is
NegInfinity
or
other
is
PosInfinity
def
__ge__
(
self
,
other
):
return
self
is
PosInfinity
or
other
is
NegInfinity
def
__eq__
(
self
,
other
):
return
self
is
other
def
__ne__
(
self
,
other
):
return
self
is
not
other
def
__cmp__
(
self
,
other
):
"""
Positive infinity compares as greater than everything
except itself, negative infinity compares as less than
everything except itself.
"""
if
self
is
other
:
return
0
if
self
is
PosInfinity
:
return
1
# self is NegInfinity
return
-
1
def
__nonzero__
(
self
):
"""
...
...
test/segments_verify.py
View file @
37e19aa6
...
...
@@ -67,17 +67,6 @@ def set2():
class
test_infinity
(
unittest
.
TestCase
):
def
test_math
(
self
):
a
=
segments
.
infinity
()
self
.
assertEqual
(
-
a
,
-
a
)
self
.
assertLess
(
-
a
,
0
)
self
.
assertLess
(
-
a
,
a
)
self
.
assertGreater
(
0
,
-
a
)
self
.
assertLess
(
0
,
a
)
self
.
assertGreater
(
a
,
-
a
)
self
.
assertGreater
(
a
,
0
)
self
.
assertEqual
(
a
,
a
)
@
unittest
.
skipIf
(
sys
.
version_info
.
major
>=
3
,
'Python 3 does not have cmp'
)
def
test__cmp__
(
self
):
...
...
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