Skip to content

Commit

Permalink
Merge pull request #752 from markotoplak/fix-multifile-bug
Browse files Browse the repository at this point in the history
Rewrite multifle test for compatibility with different Orange versions
  • Loading branch information
markotoplak authored Oct 2, 2024
2 parents f5fdbb2 + dbb4f4b commit 263af77
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions orangecontrib/spectroscopy/tests/test_owmultifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
wns_to_unique_str, decimals_neeeded_for_unique_str


class ReadImaginaryFile(SPAReader):
read_count = -1

def read_spectra(self):
type(self).read_count += 1
if type(self).read_count == 0:
return np.array([1, 2]), np.array([[42, 41]]), None
return np.array([1, 2 + 1e-10]), np.array([[43, 44]]), None


class TestOWFilesAuxiliary(unittest.TestCase):

def test_numpy_union(self):
Expand Down Expand Up @@ -233,15 +243,6 @@ def read_spectra(self):

def test_spectra_almost_same_wavenumbers(self):

class ReadImaginaryFile(SPAReader):
read_count = -1

def read_spectra(self):
type(self).read_count += 1
if type(self).read_count == 0:
return np.array([1, 2]), np.array([[42, 41]]), None
return np.array([1, 2 + 1e-10]), np.array([[43, 44]]), None

with patch.object(FileFormat, "registry", {"SPAReader": ReadImaginaryFile}):
# clear LRU cache so that new classes get use
FileFormat._ext_to_attr_if_attr2.cache_clear()
Expand Down

0 comments on commit 263af77

Please sign in to comment.