(self)
| 274 | assert c * c == as_expr((1 + 2j)**2) |
| 275 | |
| 276 | def test_substitute(self): |
| 277 | x = as_symbol("x") |
| 278 | y = as_symbol("y") |
| 279 | z = as_symbol("z") |
| 280 | a = as_array((x, y)) |
| 281 | |
| 282 | assert x.substitute({x: y}) == y |
| 283 | assert (x + y).substitute({x: z}) == y + z |
| 284 | assert (x * y).substitute({x: z}) == y * z |
| 285 | assert (x**4).substitute({x: z}) == z**4 |
| 286 | assert (x / y).substitute({x: z}) == z / y |
| 287 | assert x.substitute({x: y + z}) == y + z |
| 288 | assert a.substitute({x: y + z}) == as_array((y + z, y)) |
| 289 | |
| 290 | assert as_ternary(x, y, |
| 291 | z).substitute({x: y + z}) == as_ternary(y + z, y, z) |
| 292 | assert as_eq(x, y).substitute({x: y + z}) == as_eq(y + z, y) |
| 293 | |
| 294 | def test_fromstring(self): |
| 295 |
nothing calls this directly
no test coverage detected