Skip to content

Commit

Permalink
tests(db-plugins): fix deltajd field
Browse files Browse the repository at this point in the history
  • Loading branch information
dirodriguezm committed Nov 30, 2023
1 parent 0c4e3ff commit 6b794db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions libs/db-plugins/tests/unittest/db/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def create_2_objects(self):
stellar=False,
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1.0,
meanra=100.0,
sigmara=0.1,
meandec=50.0,
Expand Down Expand Up @@ -88,6 +89,7 @@ def create_2_objects(self):
sigmadec=0.1,
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1.0,
meanra=100.0,
meandec=50.0,
ndet=5,
Expand Down
15 changes: 10 additions & 5 deletions libs/db-plugins/tests/unittest/db/test_mongo_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ def test_object_creates(self):
sid="sid",
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1,
corrected=True,
stellar=True,
sigmara=.1,
sigmadec=.2,
sigmara=0.1,
sigmadec=0.2,
meanra=100.0,
meandec=50.0,
ndet="ndet",
Expand Down Expand Up @@ -67,7 +68,9 @@ def test_detection_creates(self):
self.assertEqual(d["aid"], "aid")

def test_detection_fails_creation(self):
with self.assertRaisesRegex(AttributeError, "Detection model needs .+? attribute"):
with self.assertRaisesRegex(
AttributeError, "Detection model needs .+? attribute"
):
models.Detection()

def test_detection_with_extra_fields(self):
Expand Down Expand Up @@ -152,7 +155,7 @@ def test_forced_photometry_creates(self):
parent_candid="parent_candid",
has_stamp="has_stamp",
rbversion="rbversion",
extra_fields={},
extra_fields={},
)
self.assertIsInstance(fp, models.ForcedPhotometry)
self.assertIsInstance(fp, dict)
Expand All @@ -174,7 +177,9 @@ def test_non_detection_creates(self):
self.assertEqual(o["aid"], "aid")

def test_non_detection_fails_creation(self):
with self.assertRaisesRegex(AttributeError, "NonDetection model needs .+ attribute"):
with self.assertRaisesRegex(
AttributeError, "NonDetection model needs .+ attribute"
):
models.NonDetection()
# self.assertEqual(str(e.exception), "NonDetection model needs aid attribute")

Expand Down
15 changes: 9 additions & 6 deletions libs/db-plugins/tests/unittest/db/test_probabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def create_2_objects(self):
sid="sid",
corrected=True,
stellar=True,
sigmara=.1,
sigmadec=.1,
sigmara=0.1,
sigmadec=0.1,
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1,
meanra=100.0,
meandec=50.0,
ndet=2,
Expand Down Expand Up @@ -54,10 +55,11 @@ def create_2_objects(self):
tid="tid2",
corrected=True,
stellar=True,
sigmara=.1,
sigmadec=.1,
sigmara=0.1,
sigmadec=0.1,
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1,
meanra=100.0,
meandec=50.0,
ndet=5,
Expand Down Expand Up @@ -88,10 +90,11 @@ def create_simple_object(self):
tid="tid3",
corrected=True,
stellar=True,
sigmara=.1,
sigmadec=.1,
sigmara=0.1,
sigmadec=0.1,
lastmjd="lastmjd",
firstmjd="firstmjd",
deltajd=1,
meanra=100.0,
meandec=50.0,
ndet=5,
Expand Down

0 comments on commit 6b794db

Please sign in to comment.