Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests remove unittest from gaia and dace #2383

Merged
merged 2 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions astroquery/dace/tests/test_dace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import unittest
import json
from astroquery.dace import Dace

Expand All @@ -8,24 +7,19 @@
}


class TestDaceClass(unittest.TestCase):
def test_transform_data_as_dict(self):
expected_parameter_dict = {'ccf_noise': [0.005320016177906, 0.00393390440796704, 0.0032324617496158],
'ins_name': ['CORALIE98', 'CORALIE98', 'HARPS'],
'drs_qc': [True, True, False],
'rjd': [51031, 51039, 51088],
'rv': [31300.4226771379, 31295.5671320506, 31294.3391634734],
'rv_err': [5.420218247708816, 4.0697289792344185, 3.4386352834851026]}
with open(self._data_path('parameter_list.json'), 'r') as file:
parameter_list = json.load(file)
parameter_dict = Dace.transform_data_as_dict(parameter_list)
assert parameter_dict == expected_parameter_dict
def test_transform_data_as_dict():
expected_parameter_dict = {'ccf_noise': [0.005320016177906, 0.00393390440796704, 0.0032324617496158],
'ins_name': ['CORALIE98', 'CORALIE98', 'HARPS'],
'drs_qc': [True, True, False],
'rjd': [51031, 51039, 51088],
'rv': [31300.4226771379, 31295.5671320506, 31294.3391634734],
'rv_err': [5.420218247708816, 4.0697289792344185, 3.4386352834851026]}
with open(_data_path('parameter_list.json'), 'r') as file:
parameter_list = json.load(file)
parameter_dict = Dace.transform_data_as_dict(parameter_list)
assert parameter_dict == expected_parameter_dict

@staticmethod
def _data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)


if __name__ == "__main__":
unittest.main()
def _data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)
8 changes: 1 addition & 7 deletions astroquery/gaia/tests/test_gaiatap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


"""
import unittest
import os
from unittest.mock import patch

Expand All @@ -40,7 +39,7 @@ def data_path(filename):
return os.path.join(data_dir, filename)


class TestTap(unittest.TestCase):
class TestTap():

def test_query_object(self):
conn_handler = DummyConnHandler()
Expand Down Expand Up @@ -609,8 +608,3 @@ def test_logout(self, mock_logout):
mock_logout.side_effect = HTTPError("Login error")
tap.logout()
assert (mock_logout.call_count == 3)


if __name__ == "__main__":
# import sys;sys.argv = ['', 'Test.testName']
unittest.main()