-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new tests for edit_attrs and command line
this commit includes new tests for creating straditizer from the command line
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Test module for the :mod:`straditizer.widgets` module""" | ||
import _base_testing as bt | ||
import unittest | ||
import numpy as np | ||
|
||
|
||
class StraditizerWidgetsTest(bt.StraditizeWidgetsTestCase): | ||
"""Test case for the :class:`straditizer.widgets.StraditizerWidgets`""" | ||
|
||
def test_edit_attrs(self): | ||
"""Test editing the attributes""" | ||
self.open_img() | ||
n = len(self.window.dataframeeditors) | ||
editor, combo = self.straditizer_widgets.edit_attrs() | ||
self.assertEqual(len(self.window.dataframeeditors), n+1) | ||
combo.setCurrentText('latitude') | ||
self.assertIn('latitude', self.straditizer.attrs.index) | ||
|
||
def test_create_straditizer_from_args_01(self): | ||
fname = self.get_fig_path('basic_diagram.png') | ||
xlim = np.array([9, 30]) | ||
ylim = np.array([10, 30]) | ||
self.straditizer_widgets.create_straditizer_from_args( | ||
[fname], | ||
None, # project | ||
xlim, ylim, | ||
False, # full | ||
'area' # reader_type | ||
) | ||
self.assertIsNotNone(self.straditizer) | ||
self.assertEqual(list(self.straditizer.data_xlim), list(xlim)) | ||
self.assertEqual(list(self.straditizer.data_ylim), list(ylim)) | ||
|
||
def test_create_straditizer_from_args_02(self): | ||
fname = self.get_fig_path('basic_diagram.png') | ||
self.straditizer_widgets.create_straditizer_from_args( | ||
[fname], | ||
None, # project | ||
None, None, # xlim, ylim | ||
True, # full | ||
'area' # reader_type | ||
) | ||
self.assertIsNotNone(self.straditizer) | ||
self.assertEqual(list(self.straditizer.data_xlim), [0, 40]) | ||
self.assertEqual(list(self.straditizer.data_ylim), [0, 40]) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |