all tested are passed! :D

This commit is contained in:
Lafrite 2015-03-10 14:04:04 +01:00
parent 25127acde3
commit b508a8afb4
2 changed files with 10 additions and 2 deletions

View File

@ -434,7 +434,12 @@ class op(object):
return True
elif op2.isalpha():
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
else:
return False
@ -586,6 +591,9 @@ if __name__ == '__main__':
from .polynom import Polynom
print(tex([Polynom([1,2,3]), 2, op.mul]))
print("-----------------")
from .fraction import Fraction
print(tex([2, Fraction(1,2), op.mul]))
print("-----------------")
#import doctest
#doctest.testmod()

View File

@ -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('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, '2a') == True
assert op.mul.is_visible(2, '(-2a)') == True