add doctest in random_expression
This commit is contained in:
parent
573945a63a
commit
ffd2a55b65
@ -31,6 +31,19 @@ class RdExpression(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_form(cls, form):
|
def set_form(cls, form):
|
||||||
|
""" Define whether RdExpression create expression with Expression (nice render) or if it only replace inside {} not taking care or render
|
||||||
|
|
||||||
|
>>> form = "{a}*{b}"
|
||||||
|
>>> exp = RdExpression(form)()
|
||||||
|
>>> print(type(exp))
|
||||||
|
<class 'pymath.expression.Expression'>
|
||||||
|
>>> RdExpression.set_form("raw")
|
||||||
|
>>> form = "{a}*{b}"
|
||||||
|
>>> exp = RdExpression(form)()
|
||||||
|
>>> print(type(exp))
|
||||||
|
<class 'str'>
|
||||||
|
"""
|
||||||
|
|
||||||
cls.FORM = form
|
cls.FORM = form
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -194,7 +207,8 @@ if __name__ == '__main__':
|
|||||||
rdExp3 = RdExpression(form, cond)
|
rdExp3 = RdExpression(form, cond)
|
||||||
desc_rdExp(rdExp3)
|
desc_rdExp(rdExp3)
|
||||||
|
|
||||||
|
import doctest
|
||||||
|
doctest.testmod()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user