From f16aeaa7428034e008ef90bd0cc6e3cdaeda550d Mon Sep 17 00:00:00 2001 From: Evan <93949832+Exu-112@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:06:52 -0400 Subject: [PATCH] made tests use keyword arguments --- tests/test_astrometry.py | 48 ++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/tests/test_astrometry.py b/tests/test_astrometry.py index 326809975..63812df99 100644 --- a/tests/test_astrometry.py +++ b/tests/test_astrometry.py @@ -100,10 +100,20 @@ def test_ingest_parallaxes(temp_db, t_plx): def test_parallax_exceptions(temp_db): with pytest.raises(AstroDBError) as error_message: - ingest_parallax(temp_db, "bad source", 1, 0, "Ref 1") + ingest_parallax( + temp_db, source="bad source", parallax=1, plx_error=0, reference="Ref 1" + ) assert "does not exist in Sources table" in str(error_message.value) - flags = ingest_parallax(temp_db, "bad source", 1, 0, "Ref 1", "comment", False) + flags = ingest_parallax( + temp_db, + source="bad source", + parallax=1, + plx_error=0, + reference="Ref 1", + comment="comment", + raise_error=False, + ) assert flags == { "added": False, "content": { @@ -118,11 +128,20 @@ def test_parallax_exceptions(temp_db): } with pytest.raises(AstroDBError) as error_message: - ingest_parallax(temp_db, "Fake 1", 1, 0, "bad ref") + ingest_parallax( + temp_db, source="Fake 1", parallax=1, plx_error=0, reference="bad ref" + ) assert "does not exist in Publications table" in str(error_message.value) - flags = ingest_parallax(temp_db, "Fake 1", 1, 0, "bad ref", "comment", False) - print(flags) + flags = ingest_parallax( + temp_db, + source="Fake 1", + parallax=1, + plx_error=0, + reference="bad ref", + comment="comment", + raise_error=False, + ) assert flags == { "added": False, "content": { @@ -136,15 +155,26 @@ def test_parallax_exceptions(temp_db): "message": "Reference 'bad ref' does not exist in Publications table. ", } - ingest_parallax(temp_db, "Fake 2", 1, 1, "Ref 2") + ingest_parallax( + temp_db, source="Fake 2", parallax=1, plx_error=1, reference="Ref 2" + ) with pytest.raises(AstroDBError) as error_message: - ingest_parallax(temp_db, "Fake 2", 1, 1, "Ref 2") + ingest_parallax( + temp_db, source="Fake 2", parallax=1, plx_error=1, reference="Ref 2" + ) assert "Duplicate measurement exists with same reference" in str( error_message.value ) - flags = ingest_parallax(temp_db, "Fake 2", 1, 1, "Ref 2", "comment", False) - print(flags) + flags = ingest_parallax( + temp_db, + source="Fake 2", + parallax=1, + plx_error=1, + reference="Ref 2", + comment="comment", + raise_error=False, + ) assert flags == { "added": False, "content": {},