Skip to content

Commit bb408d8

Browse files
liambeguinTeque5
authored andcommitted
tests: archive: make sure we don't change samples
Make sure opening and closing a sigmf archive doesn't alter samples. Right now this test case fails because SigMFArchiveReader sets the data_file to the tarfile on open. Signed-off-by: Liam Beguin <liambeguin@gmail.com>
1 parent 86ef997 commit bb408d8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_archivereader.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import numpy as np
1313

14+
import sigmf
1415
from sigmf import SigMFArchiveReader, SigMFFile, __specification__
1516

1617

@@ -80,3 +81,14 @@ def test_access_data_without_untar(self):
8081
len(readback),
8182
"Mismatch in expected readback length",
8283
)
84+
85+
86+
def test_archiveread_data_file_unchanged(test_sigmffile):
87+
with tempfile.NamedTemporaryFile(suffix='.sigmf') as temp:
88+
input_samples = test_sigmffile.read_samples()
89+
test_sigmffile.archive(temp.name)
90+
91+
arc = sigmf.sigmffile.fromfile(temp.name)
92+
output_samples = arc.read_samples()
93+
94+
assert np.array_equal(input_samples, output_samples)

0 commit comments

Comments
 (0)