Feat: doctest for composing Expressions

This commit is contained in:
Bertrand Benjamin 2019-07-16 09:31:30 +02:00
parent f8e1c7f962
commit a5f062a151

View File

@ -461,6 +461,8 @@ class Expression(object):
<Quadratic 3n^2 + 2n + 1> <Quadratic 3n^2 + 2n + 1>
>>> f("u_n") >>> f("u_n")
<Exp: 3u_n^2 + 2u_n + 1> <Exp: 3u_n^2 + 2u_n + 1>
>>> f(f)
<Polynomial 36x^2 + 16x + 6 + 36x^3 + 27x^4>
""" """
tree = self._tree tree = self._tree
variable = (set(tree.get_leafs(extract_variable)) - {None}).pop() variable = (set(tree.get_leafs(extract_variable)) - {None}).pop()