istr-python 1.0.6__tar.gz → 1.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {istr_python-1.0.6 → istr_python-1.0.7}/PKG-INFO +1 -1
- {istr_python-1.0.6 → istr_python-1.0.7}/istr/istr.py +8 -3
- {istr_python-1.0.6 → istr_python-1.0.7}/istr_python.egg-info/PKG-INFO +1 -1
- {istr_python-1.0.6 → istr_python-1.0.7}/pyproject.toml +1 -1
- {istr_python-1.0.6 → istr_python-1.0.7}/tests/test_istr.py +5 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/README.md +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/istr/LICENSE.txt +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/istr/__init__.py +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.0.6 → istr_python-1.0.7}/setup.cfg +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# |_||___/ \__||_|
|
|
6
6
|
# strings you can count on
|
|
7
7
|
|
|
8
|
-
__version__ = "1.0.
|
|
8
|
+
__version__ = "1.0.7"
|
|
9
9
|
import functools
|
|
10
10
|
import math
|
|
11
11
|
import copy
|
|
@@ -315,7 +315,10 @@ class istr(str):
|
|
|
315
315
|
raise TypeError(f"unsupported operand for {op}: {self._frepr(other)} and {self._frepr(self)}")
|
|
316
316
|
else:
|
|
317
317
|
raise TypeError(f"unsupported operand for {op}: {self._frepr(self)} and {self._frepr(other)}")
|
|
318
|
-
|
|
318
|
+
if "<" in op or ">" in op:
|
|
319
|
+
return getattr(self._as_int, name)(self._to_int(other))
|
|
320
|
+
else:
|
|
321
|
+
return istr(getattr(self._as_int, name)(self._to_int(other)))
|
|
319
322
|
else:
|
|
320
323
|
if not self.is_int():
|
|
321
324
|
raise TypeError(f"unsupported operand for {op}: {self._frepr(self)}")
|
|
@@ -551,7 +554,9 @@ class istr(str):
|
|
|
551
554
|
|
|
552
555
|
|
|
553
556
|
def main():
|
|
554
|
-
|
|
557
|
+
print(repr(istr(8) < 9))
|
|
558
|
+
|
|
555
559
|
|
|
556
560
|
if __name__ == "__main__":
|
|
557
561
|
main()
|
|
562
|
+
|
|
@@ -68,6 +68,7 @@ def test_arithmetic():
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
def test_lt():
|
|
71
|
+
assert type(two < three) == bool
|
|
71
72
|
assert two < three
|
|
72
73
|
assert 2 < three
|
|
73
74
|
assert two < 3
|
|
@@ -82,6 +83,7 @@ def test_lt():
|
|
|
82
83
|
|
|
83
84
|
|
|
84
85
|
def test_le():
|
|
86
|
+
assert type(two <= three) == bool
|
|
85
87
|
assert two <= three
|
|
86
88
|
assert 2 <= three
|
|
87
89
|
assert two <= 3
|
|
@@ -92,6 +94,7 @@ def test_le():
|
|
|
92
94
|
|
|
93
95
|
|
|
94
96
|
def test_gt():
|
|
97
|
+
assert type(three > two) == bool
|
|
95
98
|
assert three > two
|
|
96
99
|
assert 3 > two
|
|
97
100
|
assert three > 2
|
|
@@ -106,6 +109,7 @@ def test_gt():
|
|
|
106
109
|
|
|
107
110
|
|
|
108
111
|
def test_ge():
|
|
112
|
+
assert type(three >= two) == bool
|
|
109
113
|
assert three >= two
|
|
110
114
|
assert 3 >= two
|
|
111
115
|
assert three >= 2
|
|
@@ -628,3 +632,4 @@ def test_subclassing():
|
|
|
628
632
|
|
|
629
633
|
if __name__ == "__main__":
|
|
630
634
|
pytest.main(["-vv", "-s", "-x", __file__])
|
|
635
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|