Feat: doctest for operation between Token and str

This commit is contained in:
Bertrand Benjamin 2019-10-13 22:18:44 +02:00
parent e24bff23db
commit 207dead5d0

View File

@ -122,6 +122,10 @@ class Token(object):
... print(i)
3 + 7
10
>>> a = Integer(3)
>>> c = a + "x"
>>> c
<Linear x + 3>
>>> from .number import Fraction
>>> a = Fraction("4/3")
>>> b = Integer(7)
@ -156,6 +160,9 @@ class Token(object):
>>> c = a * 7
>>> c
<Integer 21>
>>> c = a * "x"
>>> c
<Linear 3x>
>>> from .number import Fraction
>>> a = Fraction("4/3")
>>> b = Integer(7)
@ -227,6 +234,9 @@ class Token(object):
>>> c = 7 + a
>>> c
<Integer 10>
>>> c = "x" + a
>>> c
<Linear x + 3>
"""
return self._roperate(other, "+")
@ -239,6 +249,9 @@ class Token(object):
>>> c = 7 * a
>>> c
<Integer 21>
>>> c = "x" * a
>>> c
<Linear 3x>
"""
return self._roperate(other, "*")