diff --git a/tests/test_data.py b/tests/test_data.py index 092896ec7..96a807a7e 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -148,40 +148,6 @@ def test_proper_motion_refs(db): assert len(t) == 44, f"found {len(t)} proper motion reference entries for {ref}" -def test_parallax_refs(db): - # Test total odopted measuruments - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.adopted == 1).astropy() - assert len(t) == 1876, f"found {len(t)} adopted parallax measuruments." - - ref = "GaiaDR3" - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() - assert len(t) == 1, f"found {len(t)} parallax reference entries for {ref}" - - ref = "GaiaDR2" - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() - assert len(t) == 1076, f"found {len(t)} parallax reference entries for {ref}" - - t = ( - db.query(db.Parallaxes) - .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1)) - .astropy() - ) - assert len(t) == 33, f"found {len(t)} adopted parallax reference entries for {ref}" - - ref = "GaiaEDR3" - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() - assert len(t) == 1134, f"found {len(t)} parallax reference entries for {ref}" - - t = ( - db.query(db.Parallaxes) - .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1)) - .astropy() - ) - assert ( - len(t) == 1077 - ), f"found {len(t)} adopted parallax reference entries for {ref}" - - def test_missions(db): # If 2MASS designation in Names, 2MASS photometry should exist stm = except_( @@ -552,23 +518,11 @@ def test_Kirk19_ingest(db): t = db.query(db.Sources).filter(db.Sources.c.reference == ref).astropy() assert len(t) == 1, f"found {len(t)} sources for {ref}" - # Test spectral types added - - # Test parallaxes - ref = "Kirk19" - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() - assert len(t) == 64, f"found {len(t)} parallax entries for {ref}" - # Test proper motions added ref = "Kirk19" t = db.query(db.ProperMotions).filter(db.ProperMotions.c.reference == ref).astropy() assert len(t) == 182, f"found {len(t)} proper motion entries for {ref}" - # Test parallaxes added for ATLAS - ref = "Mart18" - t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() - assert len(t) == 15, f"found {len(t)} parallax entries for {ref}" - def test_Best2020_ingest(db): # Test for Best20.257 proper motions added diff --git a/tests/test_data_astrometry.py b/tests/test_data_astrometry.py new file mode 100644 index 000000000..7890379b5 --- /dev/null +++ b/tests/test_data_astrometry.py @@ -0,0 +1,54 @@ +from sqlalchemy import except_, select, and_ + + +def test_parallax_refs(db): + # Test total adopted measuruments + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.adopted == 1).astropy() + assert len(t) == 1876, f"found {len(t)} adopted parallax measuruments." + + ref = "GaiaDR3" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 1, f"found {len(t)} parallax reference entries for {ref}" + + ref = "GaiaDR2" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 1076, f"found {len(t)} parallax reference entries for {ref}" + + t = ( + db.query(db.Parallaxes) + .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1)) + .astropy() + ) + assert len(t) == 33, f"found {len(t)} adopted parallax reference entries for {ref}" + + ref = "GaiaEDR3" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 1134, f"found {len(t)} parallax reference entries for {ref}" + + t = ( + db.query(db.Parallaxes) + .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1)) + .astropy() + ) + assert ( + len(t) == 1077 + ), f"found {len(t)} adopted parallax reference entries for {ref}" + + ref = "Kirk21" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 325, f"found {len(t)} parallax reference entries for {ref}" + + t = ( + db.query(db.Parallaxes) + .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1)) + .astropy() + ) + assert len(t) == 248, f"found {len(t)} adopted parallax reference entries for {ref}" + + ref = "Kirk19" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 64, f"found {len(t)} parallax entries for {ref}" + + ref = "Mart18" + t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy() + assert len(t) == 15, f"found {len(t)} parallax entries for {ref}"