all tested are passed! :D
This commit is contained in:
parent
25127acde3
commit
b508a8afb4
|
@ -434,7 +434,12 @@ class op(object):
|
||||||
return True
|
return True
|
||||||
elif op2.isalpha():
|
elif op2.isalpha():
|
||||||
return False
|
return False
|
||||||
elif (op2[0] == "(" or op2[0].isdecimal()) and not ("+" in op2):
|
elif op2[0].isdecimal():
|
||||||
|
return True
|
||||||
|
elif op2[0] == "(" and not ("+" in op2 or "-" in op2[3:]):
|
||||||
|
return True
|
||||||
|
# Giga bricolage...
|
||||||
|
elif "frac" in op2:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@ -586,6 +591,9 @@ if __name__ == '__main__':
|
||||||
from .polynom import Polynom
|
from .polynom import Polynom
|
||||||
print(tex([Polynom([1,2,3]), 2, op.mul]))
|
print(tex([Polynom([1,2,3]), 2, op.mul]))
|
||||||
print("-----------------")
|
print("-----------------")
|
||||||
|
from .fraction import Fraction
|
||||||
|
print(tex([2, Fraction(1,2), op.mul]))
|
||||||
|
print("-----------------")
|
||||||
|
|
||||||
#import doctest
|
#import doctest
|
||||||
#doctest.testmod()
|
#doctest.testmod()
|
||||||
|
|
|
@ -9,7 +9,7 @@ def test_mul_is_visible():
|
||||||
assert op.mul.is_visible(2,-3) == True
|
assert op.mul.is_visible(2,-3) == True
|
||||||
assert op.mul.is_visible(-2,3) == True
|
assert op.mul.is_visible(-2,3) == True
|
||||||
assert op.mul.is_visible('a',2) == True
|
assert op.mul.is_visible('a',2) == True
|
||||||
assert op.mul.is_visible('2a + 1', 2) == True
|
assert op.mul.is_visible('(2a + 1)', 2) == True
|
||||||
assert op.mul.is_visible(2, '(-2)') == True
|
assert op.mul.is_visible(2, '(-2)') == True
|
||||||
assert op.mul.is_visible(2, '2a') == True
|
assert op.mul.is_visible(2, '2a') == True
|
||||||
assert op.mul.is_visible(2, '(-2a)') == True
|
assert op.mul.is_visible(2, '(-2a)') == True
|
||||||
|
|
Loading…
Reference in New Issue