Skip to content

Commit

Permalink
Try to pass some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dlilien committed May 24, 2024
1 parent 3866f2f commit df2e783
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 9 additions & 2 deletions impdar/tests/test_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import numpy as np
from impdar.lib.RadarData._RadarDataSaving import CONVERSIONS_ENABLED
from impdar.lib.RadarData import RadarData
from matplotlib import colormaps

try:
import matplotlib
Expand Down Expand Up @@ -83,9 +84,15 @@ def test_update_polarity(self):
self.assertEqual(self.ip.dat.picks.pickparams.pol, -1)

def test_reverse_color(self):
self.assertEqual(self.ip.im.get_cmap(), plt.cm.get_cmap(self.ip.ColorSelector.currentText()))
if hasattr(plt.cm, "get_cmap"):
self.assertEqual(self.ip.im.get_cmap(), plt.cm.get_cmap(self.ip.ColorSelector.currentText()))
else:
self.assertEqual(self.ip.im.get_cmap(), colormaps[self.ip.ColorSelector.currentText()])
self.ip._update_color_reversal(QtCore.Qt.Checked)
self.assertEqual(self.ip.im.get_cmap(), plt.cm.get_cmap(self.ip.ColorSelector.currentText() + '_r'))
if hasattr(plt.cm, "get_cmap"):
self.assertEqual(self.ip.im.get_cmap(), plt.cm.get_cmap(self.ip.ColorSelector.currentText() + '_r'))
else:
self.assertEqual(self.ip.im.get_cmap(), colormaps[self.ip.ColorSelector.currentText() + '_r'])

def test_select_lines_click(self):
data = RadarData(os.path.join(THIS_DIR, 'input_data', 'small_data_picks.mat'))
Expand Down
6 changes: 3 additions & 3 deletions impdar/tests/test_impproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_inputfile(self, load_patch, agc_patch):
impproc.main()
self.assertTrue(agc_patch.called)
self.assertTrue(load_patch.called)
self.assertTrue(load_patch.called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data.mat')]))
load_patch.assert_called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data.mat')])

impproc.sys.argv = ['dummy', 'agc', os.path.join(THIS_DIR, 'input_data', 'small_data.mat'), os.path.join(THIS_DIR, 'input_data', 'small_data.mat')]
impproc.main()
Expand All @@ -53,7 +53,7 @@ def test_outputfile(self, load_patch, agc_patch):
impproc.main()
self.assertTrue(agc_patch.called)
self.assertTrue(load_patch.called)
self.assertTrue(load_patch.called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data.mat')]))
load_patch.assert_called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data.mat')])
self.assertTrue(rd_patch[0].save.called)
rd_patch[0].save.assert_called_with('dummy')

Expand All @@ -67,7 +67,7 @@ def test_outputraw(self, load_patch, agc_patch):
impproc.sys.argv = ['dummy', 'agc', os.path.join(THIS_DIR, 'input_data', 'small_data_raw.mat')]
impproc.main()
self.assertTrue(load_patch.called)
self.assertTrue(load_patch.called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data_raw.mat')]))
load_patch.assert_called_with('mat', [os.path.join(THIS_DIR, 'input_data', 'small_data_raw.mat')])
for p in rd_patch:
self.assertTrue(p.save.called)
p.save.assert_called_with(os.path.join(THIS_DIR, 'input_data', 'small_data_agc.mat'))
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import numpy
ext_modules = [Extension("impdar.lib.migrationlib.mig_cython",
sources=["impdar/lib/migrationlib/_mig_cython.pyx"],
include_dirs=[numpy.get_include()]),
include_dirs=[numpy.get_include()],
optional=True),
Extension("impdar.lib.ApresData.coherence",
sources=["impdar/lib/ApresData/_coherence.pyx"],
include_dirs=[numpy.get_include()])]
include_dirs=[numpy.get_include()],
optional=True)]

setup(ext_modules=ext_modules)

0 comments on commit df2e783

Please sign in to comment.