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

7 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 16:47 -0500

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]}))