()
| 46 | |
| 47 | |
| 48 | def test_globalmethod(): |
| 49 | x = Foo() |
| 50 | |
| 51 | assert x.f() == 1 |
| 52 | |
| 53 | with dask.config.set(f=lambda: 2): |
| 54 | assert x.f() == 2 |
| 55 | |
| 56 | with dask.config.set(f=foo): |
| 57 | assert x.f is foo |
| 58 | assert x.f() == "foo" |
| 59 | |
| 60 | assert x.g is foo |
| 61 | assert x.g() == "foo" |
| 62 | |
| 63 | with dask.config.set(g=False): |
| 64 | assert x.g is bar |
| 65 | assert x.g() == "bar" |