Skip to content

Commit

Permalink
Add regression tests for issue #29.
Browse files Browse the repository at this point in the history
  • Loading branch information
vnmabus committed Nov 21, 2023
1 parent 147d8df commit a2dec57
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions rdata/tests/test_rdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,22 @@ def test_altrep_compact_intseq(self) -> None:
"test_altrep_compact_intseq": np.arange(1000),
})

def test_altrep_compact_intseq_asymmetric(self) -> None:
"""
Test alternative representation of sequences of ints.
This test an origin different from 0, to reproduce
issue #29.
"""
parsed = rdata.parser.parse_file(
TESTDATA_PATH / "test_altrep_compact_intseq_asymmetric.rda",
)
converted = rdata.conversion.convert(parsed)

np.testing.assert_equal(converted, {
"test_altrep_compact_intseq_asymmetric": np.arange(-5, 6),
})

def test_altrep_compact_realseq(self) -> None:
"""Test alternative representation of sequences of ints."""
parsed = rdata.parser.parse_file(
Expand All @@ -643,6 +659,22 @@ def test_altrep_compact_realseq(self) -> None:
"test_altrep_compact_realseq": np.arange(1000.0),
})

def test_altrep_compact_realseq_asymmetric(self) -> None:
"""
Test alternative representation of sequences of ints.
This test an origin different from 0, to reproduce
issue #29.
"""
parsed = rdata.parser.parse_file(
TESTDATA_PATH / "test_altrep_compact_realseq_asymmetric.rda",
)
converted = rdata.conversion.convert(parsed)

np.testing.assert_equal(converted, {
"test_altrep_compact_realseq_asymmetric": np.arange(-5.0, 6.0),
})

def test_altrep_deferred_string(self) -> None:
"""Test alternative representation of deferred strings."""
parsed = rdata.parser.parse_file(
Expand Down

0 comments on commit a2dec57

Please sign in to comment.