home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 277703296

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1252#issuecomment-277703296 https://api.github.com/repos/pydata/xarray/issues/1252 277703296 MDEyOklzc3VlQ29tbWVudDI3NzcwMzI5Ng== 6628425 2017-02-06T14:46:36Z 2017-02-06T15:09:35Z MEMBER

Thanks for the quick feedback on the tests @MaximilianR. Is this on the right track for doing things a little more idiomatically with pytest?

```python import pytest

from xarray.tests import assert_array_equal

def netcdftime_date_types(): pytest.importorskip('netCDF4')

from netcdftime import (
    DatetimeNoLeap, DatetimeJulian, DatetimeAllLeap,
    DatetimeGregorian, DatetimeProlepticGregorian, Datetime360Day)
return [DatetimeNoLeap, DatetimeJulian, DatetimeAllLeap,
        DatetimeGregorian, DatetimeProlepticGregorian, Datetime360Day]

@pytest.fixture(params=[]) def index(request): from xarray.core.netcdftimeindex import NetCDFTimeIndex

date_type = request.param
dates = [date_type(1, 1, 1), date_type(1, 2, 1),
         date_type(2, 1, 1), date_type(2, 2, 1)]
return NetCDFTimeIndex(dates)

@pytest.mark.parametrize('index', netcdftime_date_types(), indirect=True) @pytest.mark.parametrize(('field', 'expected'), [ ('year', [1, 1, 2, 2]), ('month', [1, 2, 1, 2]), ('day', [1, 1, 1, 1]), ('hour', [0, 0, 0, 0]), ('minute', [0, 0, 0, 0]), ('second', [0, 0, 0, 0]), ('microsecond', [0, 0, 0, 0]) ], ids=['year', 'month', 'day', 'hour', 'minute', 'second', 'microsecond']) def test_netcdftimeindex_field_accessors(index, field, expected): result = getattr(index, field) assert_array_equal(result, expected) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  205473898
Powered by Datasette · Queries took 3.594ms · About: xarray-datasette