diff --git a/src/adler/dataclasses/AdlerPlanetoid.py b/src/adler/dataclasses/AdlerPlanetoid.py index 2b1d6a3..7d0e381 100644 --- a/src/adler/dataclasses/AdlerPlanetoid.py +++ b/src/adler/dataclasses/AdlerPlanetoid.py @@ -87,7 +87,9 @@ def construct_from_SQL( ) if len(observations_by_filter) == 0: - raise Exception("No observations found for this object in the given filter(s). Check SSOID and try again.") + raise Exception( + "No observations found for this object in the given filter(s). Check SSOID and try again." + ) # redo the filter list based on the available filters in observations_by_filter filter_list = [obs_object.filter_name for obs_object in observations_by_filter] @@ -130,11 +132,13 @@ def construct_from_RSP( ) if len(observations_by_filter) == 0: - raise Exception("No observations found for this object in the given filter(s). Check SSOID and try again.") + raise Exception( + "No observations found for this object in the given filter(s). Check SSOID and try again." + ) # redo the filter list based on the available filters in observations_by_filter filter_list = [obs_object.filter_name for obs_object in observations_by_filter] - + mpcorb = cls.populate_MPCORB(cls, ssObjectId, service=service) ssobject = cls.populate_SSObject(cls, ssObjectId, filter_list, service=service) @@ -199,7 +203,11 @@ def populate_observations( data_table = get_data_table(observations_sql_query, service=service, sql_filename=sql_filename) if len(data_table) == 0: - print("WARNING: No observations found in {} filter for this object. Skipping this filter.".format(filter_name)) + print( + "WARNING: No observations found in {} filter for this object. Skipping this filter.".format( + filter_name + ) + ) else: observations_by_filter.append( Observations.construct_from_data_table(ssObjectId, filter_name, data_table) diff --git a/tests/adler/dataclasses/test_AdlerPlanetoid.py b/tests/adler/dataclasses/test_AdlerPlanetoid.py index 6c978c6..b72ea15 100644 --- a/tests/adler/dataclasses/test_AdlerPlanetoid.py +++ b/tests/adler/dataclasses/test_AdlerPlanetoid.py @@ -11,7 +11,9 @@ def test_construct_from_SQL(): - test_planetoid = AdlerPlanetoid.construct_from_SQL(ssoid, test_db_path, filter_list=["u", "g", "r", "i", "z", "y"]) + test_planetoid = AdlerPlanetoid.construct_from_SQL( + ssoid, test_db_path, filter_list=["u", "g", "r", "i", "z", "y"] + ) # testing just a few values here to ensure correct setup: these objects have their own unit tests assert test_planetoid.MPCORB.mpcH == 19.8799991607666 @@ -129,17 +131,20 @@ def test_no_observations(): with pytest.raises(Exception) as error_info: test_planetoid = AdlerPlanetoid.construct_from_SQL(826857066833589477, test_db_path) - assert error_info.value.args[0] == "No observations found for this object in the given filter(s). Check SSOID and try again." + assert ( + error_info.value.args[0] + == "No observations found for this object in the given filter(s). Check SSOID and try again." + ) def test_for_warnings(capsys): - test_planetoid = AdlerPlanetoid.construct_from_SQL(ssoid, test_db_path, filter_list=["u", "g"]) captured = capsys.readouterr() - expected = ("WARNING: No observations found in u filter for this object. Skipping this filter.\n" - + "WARNING: n unpopulated in MPCORB table for this object. Storing NaN instead.\n" - + "WARNING: uncertaintyParameter unpopulated in MPCORB table for this object. Storing NaN instead.\n") + expected = ( + "WARNING: No observations found in u filter for this object. Skipping this filter.\n" + + "WARNING: n unpopulated in MPCORB table for this object. Storing NaN instead.\n" + + "WARNING: uncertaintyParameter unpopulated in MPCORB table for this object. Storing NaN instead.\n" + ) assert captured.out == expected - \ No newline at end of file