Coverage for docs/source/examples/sub_multi_values.py: 100%
7 statements
« prev ^ index » next coverage.py v6.4.2, created at 2022-07-28 11:42 -0400
« prev ^ index » next coverage.py v6.4.2, created at 2022-07-28 11:42 -0400
1"Example substitution; adapted from t_sub.py/t_NomialSubs/test_Vector"
2from gpkit import Variable, VectorVariable
3x = Variable("x")
4y = Variable("y")
5z = VectorVariable(2, "z")
6p = x*y*z
7assert all(p.sub({x: 1, "y": 2}) == 2*z)
8assert all(p.sub({x: 1, y: 2, "z": [1, 2]}) == z.sub({z: [2, 4]}))