From 0a2fb2c46c0c05e9453239ae3b5f159182176631 Mon Sep 17 00:00:00 2001 From: Steph Merritt Date: Thu, 9 May 2024 17:59:51 +0100 Subject: [PATCH] Extra unit test. --- .../adler/dataclasses/test_AdlerPlanetoid.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/adler/dataclasses/test_AdlerPlanetoid.py b/tests/adler/dataclasses/test_AdlerPlanetoid.py index b72ea15..3ac451d 100644 --- a/tests/adler/dataclasses/test_AdlerPlanetoid.py +++ b/tests/adler/dataclasses/test_AdlerPlanetoid.py @@ -148,3 +148,23 @@ def test_for_warnings(capsys): ) assert captured.out == expected + + +def test_failed_SQL_queries(): + test_planetoid = AdlerPlanetoid.construct_from_SQL( + ssoid, test_db_path, filter_list=["u", "g", "r", "i", "z", "y"] + ) + + with pytest.raises(Exception) as error_info_1: + test_planetoid.populate_MPCORB("826857066833589477", sql_filename=test_db_path, schema="") + + assert error_info_1.value.args[0] == "No MPCORB data for this object could be found for this SSObjectId." + + with pytest.raises(Exception) as error_info_2: + test_planetoid.populate_SSObject( + "826857066833589477", filter_list=["u"], sql_filename=test_db_path, schema="" + ) + + assert ( + error_info_2.value.args[0] == "No SSObject data for this object could be found for this SSObjectId." + )