issues: 1210147360
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1210147360 | I_kwDOAMm_X85IIWIg | 6504 | test_weighted.test_weighted_operations_nonequal_coords should avoid depending on random number seed | 1217238 | closed | 0 | 1217238 | 0 | 2022-04-20T19:56:19Z | 2022-08-29T20:42:30Z | 2022-08-29T20:42:30Z | MEMBER | What happened?In testing an upgrade to the latest version of xarray in our systems, I noticed this test failing: ``` def test_weighted_operations_nonequal_coords(): # There are no weights for a == 4, so that data point is ignored. weights = DataArray(np.random.randn(4), dims=("a",), coords=dict(a=[0, 1, 2, 3])) data = DataArray(np.random.randn(4), dims=("a",), coords=dict(a=[1, 2, 3, 4])) check_weighted_operations(data, weights, dim="a", skipna=None)
It appears that this test is hard-coded to match a particular random number seed, which in turn would fix the resutls of What did you expect to happen?Whenever possible, Xarray's own tests should avoid relying on particular random number generators, e.g., in this case we could specify random numbers instead. A back-up option would be to explicitly set random seed locally inside the tests, e.g., by creating a Minimal Complete Verifiable ExampleNo response Relevant log outputNo response Anything else we need to know?No response Environment... |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6504/reactions", "total_count": 2, "+1": 2, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |