home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

3 rows where user = 14077947 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 2

  • pull 2
  • issue 1

state 1

  • closed 3

repo 1

  • xarray 3
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
1960287586 I_kwDOAMm_X850151i 8370 Testing NamedArray and Variable maxrjones 14077947 closed 0     2 2023-10-25T00:18:50Z 2023-11-28T15:11:27Z 2023-11-28T15:11:27Z CONTRIBUTOR      

Starting a new issue to continue the discussion from https://github.com/pydata/xarray/issues/8244 about the test structure for NamedArray (xref https://github.com/pydata/xarray/issues/8238).

In theory it seems like we'd want to test both Variable and NamedArray, but I also don't like the idea of them potentially diverging once we switch to a new repo. OTOH perhaps there won't be much updating of such core functionality.

Maybe we could avoid divergence by importing from the NamedArray test suite and using the same arithmetic tests but on the Variable class?

i'm of the same opinion as @TomNicholas that we can package the shared tests in namedarray, and have the tests for Variable inherit those tests while also including their own specific tests.

It should work to use pytest_collection_modifyitems to collect tests from namedarray that should be also tested in xarray without modification. It's slightly more complicated to add external tests that need to override fixtures, but https://github.com/pytest-dev/pytest/issues/421#issuecomment-943386533 lays out a nice solution (see example pseudo-code below for NamedArray/Variable example). I recognize that this type of property testing would be well suited for Hypothesis, but also expect that would slow down progress too much to be an immediate solution.

@andersy005 when do you think would be the best time to test out this method for migrating tests? I could try it out anytime and don't see many downsides to testing while namedarray is still coupled with xarray.

```python

namedarray/testing.py

import numpy as np

class NamedArrayTestSuite: @pytest.fixture def target(self): """Fixture that needs to be re-declared""" assert 0

@pytest.fixture
def data(self):
    return 0.5 * np.arange(10).reshape(2, 5)

def test_properties(self, target, data):
    assert target.dims == ("x", "y")
    assert np.array_equal(target.data, data)
    assert target.attrs == {"key": "value"}
    assert target.ndim == 2
    assert target.sizes == {"x": 2, "y": 5}
    assert target.size == 10
    assert target.nbytes == 80
    assert len(target) == 2

```

```python

namedarray/tests/test_namedarray.py

from namedarray.testing import NamedArrayTestSuite from namedarray import NamedArray

class TestNamedArray(NamedArrayTestSuite):

@pytest.fixture
def target(self, data):
    return NamedArray(["x", "y"], data, {"key": "value"})

```

```python

xarray/tests/test_variable.py

from namedarray.testing import NamedArrayTestSuite from xarray import Variable

class TestVariable(NamedArrayTestSuite):

@pytest.fixture
def target(self, data):
    data = 0.5 * np.arange(10).reshape(2, 5)
    return Variable(["x", "y"], data, {"key": "value"})

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8370/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1974983413 PR_kwDOAMm_X85eeOqN 8405 Reduce redundancy between namedarray and variable tests maxrjones 14077947 closed 0     0 2023-11-02T20:29:04Z 2023-11-28T14:38:20Z 2023-11-28T06:29:43Z CONTRIBUTOR   0 pydata/xarray/pulls/8405

Proof of concept for namedarray test structure proposed in #8370

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8405/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1306903264 PR_kwDOAMm_X847g-JH 6797 Pull xarray's nbytes from nbytes attribute on arrays maxrjones 14077947 closed 0     7 2022-07-16T21:07:11Z 2022-07-22T17:59:50Z 2022-07-22T17:25:32Z CONTRIBUTOR   0 pydata/xarray/pulls/6797

This implements the suggestion in https://github.com/pydata/xarray/issues/4842#issuecomment-769198581 to leave the nbytes calculation to the backend array.

Also removed the duplicate docs entry reported in #6565

  • [x] Closes #6565
  • [x] Closes #4842
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6797/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 2,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 58.02ms · About: xarray-datasette