Coverage for docs/source/examples/substitutions.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

6 statements  

1"Example substitution; adapted from t_sub.py/t_NomialSubs /test_Basic" 

2from gpkit import Variable 

3x = Variable("x") 

4p = x**2 

5assert p.sub({x: 3}) == 9 

6assert p.sub({x.key: 3}) == 9 

7assert p.sub({"x": 3}) == 9