From a2dec57a349c28492f1b53760b29098e6da6674d Mon Sep 17 00:00:00 2001 From: VNMabus Date: Tue, 21 Nov 2023 10:06:52 +0100 Subject: [PATCH] Add regression tests for issue #29. --- .../test_altrep_compact_intseq_asymmetric.rda | Bin 0 -> 141 bytes ...test_altrep_compact_realseq_asymmetric.rda | Bin 0 -> 144 bytes rdata/tests/test_rdata.py | 32 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 rdata/tests/data/test_altrep_compact_intseq_asymmetric.rda create mode 100644 rdata/tests/data/test_altrep_compact_realseq_asymmetric.rda diff --git a/rdata/tests/data/test_altrep_compact_intseq_asymmetric.rda b/rdata/tests/data/test_altrep_compact_intseq_asymmetric.rda new file mode 100644 index 0000000000000000000000000000000000000000..423cb3cb5f593c7f62d8cf1447f72e2df37c017e GIT binary patch literal 141 zcmb2|=3oE=X6~X+gJ)e2k`fXU(h?HWQWDZwjU*$So$r+BN=QV^XpnJZ6JzsJSQ|Ad zDn@AjjNqUtQ3CVl%#WTh1IV2j9yBLPVtz!-%-OS}f~L&m3Hia-G12tXLM^w+sh(as seyv>}n~o}ev7g{KVYkc`i31NBI9j&-Kfu7OVEUh7uI;QPhk>pD0JT##eE 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( @@ -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(