diff --git a/tests/test_lens.py b/tests/test_lens.py index f0a8af5a..59fdb023 100644 --- a/tests/test_lens.py +++ b/tests/test_lens.py @@ -62,14 +62,14 @@ def setup_method(self): if gg_lens.validity_test(mag_arc_limit=mag_arc_limit): self.gg_lens = gg_lens break - + def test_lens_id_gg(self): lens_id = self.gg_lens.generate_id() ra = self.gg_lens.deflector_position[0] dec = self.gg_lens.deflector_position[1] - ra2=12.03736542 - dec2=35.17363534 - lens_id2=self.gg_lens.generate_id(ra=ra2, dec=dec2) + ra2 = 12.03736542 + dec2 = 35.17363534 + lens_id2 = self.gg_lens.generate_id(ra=ra2, dec=dec2) assert lens_id == f"GG-LENS-{ra:.4f}_{dec:.4f}" assert lens_id2 == f"GG-LENS-{ra2:.4f}_{dec2:.4f}" @@ -312,15 +312,17 @@ def test_point_source_magnitude(pes_lens_instance): assert len(mag) >= 2 assert len(mag_unlensed) == 1 + def test_lens_id_qso(pes_lens_instance): - lens_id = pes_lens_instance.generate_id() - ra = pes_lens_instance.deflector_position[0] - dec = pes_lens_instance.deflector_position[1] - ra2=12.03736542 - dec2=35.17363534 - lens_id2=pes_lens_instance.generate_id(ra=ra2, dec=dec2) - assert lens_id == f"QSO-LENS-{ra:.4f}_{dec:.4f}" - assert lens_id2 == f"QSO-LENS-{ra2:.4f}_{dec2:.4f}" + lens_id = pes_lens_instance.generate_id() + ra = pes_lens_instance.deflector_position[0] + dec = pes_lens_instance.deflector_position[1] + ra2 = 12.03736542 + dec2 = 35.17363534 + lens_id2 = pes_lens_instance.generate_id(ra=ra2, dec=dec2) + assert lens_id == f"QSO-LENS-{ra:.4f}_{dec:.4f}" + assert lens_id2 == f"QSO-LENS-{ra2:.4f}_{dec2:.4f}" + @pytest.fixture def supernovae_lens_instance(): @@ -356,6 +358,7 @@ def supernovae_lens_instance(): break return supernovae_lens + def test_point_source_magnitude_with_lightcurve(supernovae_lens_instance): supernovae_lens = supernovae_lens_instance mag = supernovae_lens.point_source_magnitude(band="r", lensed=True)[0] @@ -538,16 +541,19 @@ def supernovae_lens_instance_double_sersic_multisource(): break return supernovae_lens + def test_lens_id_snia(supernovae_lens_instance_double_sersic_multisource): - lens_id = supernovae_lens_instance_double_sersic_multisource.generate_id() - ra = supernovae_lens_instance_double_sersic_multisource.deflector_position[0] - dec = supernovae_lens_instance_double_sersic_multisource.deflector_position[1] - ra2=12.03736542 - dec2=35.17363534 - lens_id2=supernovae_lens_instance_double_sersic_multisource.generate_id( - ra=ra2, dec=dec2) - assert lens_id == f"SNIa-LENS-{ra:.4f}_{dec:.4f}" - assert lens_id2 == f"SNIa-LENS-{ra2:.4f}_{dec2:.4f}" + lens_id = supernovae_lens_instance_double_sersic_multisource.generate_id() + ra = supernovae_lens_instance_double_sersic_multisource.deflector_position[0] + dec = supernovae_lens_instance_double_sersic_multisource.deflector_position[1] + ra2 = 12.03736542 + dec2 = 35.17363534 + lens_id2 = supernovae_lens_instance_double_sersic_multisource.generate_id( + ra=ra2, dec=dec2 + ) + assert lens_id == f"SNIa-LENS-{ra:.4f}_{dec:.4f}" + assert lens_id2 == f"SNIa-LENS-{ra2:.4f}_{dec2:.4f}" + class TestMultiSource(object): def setup_method(self):