def test_take_date_only_if_date_and_mjd_are_valid(self, capsys):
     out_dict_date = ui.get_almanac_data(ra=180, dec=0,
                                          date="2000-1-1T0:0:0")
     out_dict_both = ui.get_almanac_data(ra=180, dec=0, mjd=50000,
                                          date="2000-1-1T0:0:0")
     output = capsys.readouterr()[0].strip()
     assert output == "Warning: Both date and mjd are set. Using date"
     assert out_dict_both == out_dict_date
 def test_return_only_almanac_dict_when_flag_false(self):
     out_dict = ui.get_almanac_data(ra=180, dec=0, date="2000-1-1T0:0:0",
                                    return_full_dict=False)
     assert type(out_dict) == dict
     assert len(out_dict) == 9
 def test_return_full_dict_when_flag_true(self):
     out_dict = ui.get_almanac_data(ra=180, dec=0, date="2000-1-1T0:0:0",
                                    return_full_dict=True)
     assert type(out_dict) == dict
     assert len(out_dict) == 39
     assert type(out_dict["moon_sun_sep"]) == float
 def test_return_data_for_valid_parameters(self):
     out_dict = ui.get_almanac_data(ra=180, dec=0, date="2000-1-1T0:0:0",
                                    observatory="lasilla")
     assert type(out_dict) == dict
     assert len(out_dict) == 9
     assert out_dict["observatory"] == "lasilla"
 def test_throws_exception_for_invalid_date(self):
     with raises(ValueError):
         ui.get_almanac_data(ra=180, dec=0, date="2000-0-0T0:0:0")
 def test_throws_exception_for_invalid_mjd(self):
     with raises(ValueError):
         ui.get_almanac_data(ra=180, dec=0, mjd="s")
 def test_throws_exception_for_invalid_ra(self):
     with raises(ValueError):
         ui.get_almanac_data(ra=-10, dec=0, mjd=50000)