Skip to content

Commit

Permalink
method tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoelles committed Sep 21, 2023
1 parent fdf2b0a commit 328d0dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pathlib import Path

import pytest

from .testdata.gen_data import main as gen_data_main
from specarray import SpecArray


@pytest.fixture()
Expand Down
24 changes: 24 additions & 0 deletions tests/test_methods.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
from __future__ import annotations

from specarray import SpecArray
from pytest_check import check

from xarray import DataArray


def test_repr(testdata_specim: SpecArray):
repr = testdata_specim.__repr__()
print(repr)
check.is_true(repr.startswith("SpecArray"))
check.equal(len(repr), 5823)


def test_len(testdata_specim: SpecArray):
check.equal(len(testdata_specim), 2)


def test_getitem(testdata_specim: SpecArray):
check.equal(testdata_specim[0].shape, (1024, 448))
check.equal(testdata_specim[1].shape, (1024, 448))
check.is_instance(testdata_specim[0], DataArray)


def test_shape(testdata_specim: SpecArray):
check.equal(testdata_specim.shape, (2, 1024, 448))

0 comments on commit 328d0dd

Please sign in to comment.