Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Mar 13, 2024
1 parent e75fa3c commit 017a4cf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Wrappers/Python/test/test_dataexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ def mock_urlopen(self, mock_urlopen):
@patch('cil.utilities.dataexample.urlopen')
def test_unzip_remote_data(self, mock_urlopen):
self.mock_urlopen(mock_urlopen)
dataexample._REMOTE_DATA._download_and_extract_from_url('.')
self.assertFalse(os.path.isfile(self.tmp_file))
class RemoteData(dataexample._REMOTE_DATA):
URL = ''
RemoteData._download_and_extract_from_url('.')
self.assertTrue(os.path.isfile(self.tmp_file))
os.remove(self.tmp_file)

@patch('cil.utilities.dataexample.input', return_value='n')
@patch('cil.utilities.dataexample.urlopen')
Expand Down Expand Up @@ -220,8 +224,11 @@ def test_download_data_input_y(self, mock_urlopen, input):

for data in self.data_list:
test_func = getattr(dataexample, data)
fname = os.path.join(test_func.FOLDER, self.tmp_file)
self.assertFalse(os.path.isfile(fname))
test_func.download_data('.')
self.assertTrue(os.path.isfile(os.path.join(test_func.FOLDER,self.tmp_file)))
self.assertTrue(os.path.isfile(fname))
os.remove(fname)

# return to standard print output
sys.stdout = sys.__stdout__

0 comments on commit 017a4cf

Please sign in to comment.