@@ 1785-1817 (lines=33) @@ | ||
1782 | """Clean up after each test.""" |
|
1783 | del self.apex_out, self.in_lat, self.in_lon, self.in_alt |
|
1784 | ||
1785 | @pytest.mark.parametrize("method_name, out_comp", |
|
1786 | [("geo2apex", |
|
1787 | (56.25343704223633, 92.04932403564453)), |
|
1788 | ("apex2geo", |
|
1789 | (53.84184265136719, -66.93045806884766, |
|
1790 | 3.6222547805664362e-06)), |
|
1791 | ("geo2qd", |
|
1792 | (56.82968521118164, 92.04932403564453)), |
|
1793 | ("apex2qd", (60.498401178276744, 15.0)), |
|
1794 | ("qd2apex", (59.49138097045895, 15.0))]) |
|
1795 | def test_method_scalar_input(self, method_name, out_comp): |
|
1796 | """Test the user method against set values with scalars. |
|
1797 | ||
1798 | Parameters |
|
1799 | ---------- |
|
1800 | method_name : str |
|
1801 | Apex class method to be tested |
|
1802 | out_comp : tuple of floats |
|
1803 | Expected output values |
|
1804 | ||
1805 | """ |
|
1806 | # Get the desired methods |
|
1807 | user_method = getattr(self.apex_out, method_name) |
|
1808 | ||
1809 | # Get the user output |
|
1810 | user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
|
1811 | ||
1812 | # Evaluate the user output |
|
1813 | np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
|
1814 | ||
1815 | for out_val in user_out: |
|
1816 | assert np.asarray(out_val).shape == (), "output is not a scalar" |
|
1817 | return |
|
1818 | ||
1819 | def test_convert_to_mlt(self): |
|
1820 | """Test conversion from mlon to mlt with scalars.""" |
|
@@ 680-712 (lines=33) @@ | ||
677 | assert str(verr).find(estr) >= 0 |
|
678 | return |
|
679 | ||
680 | @pytest.mark.parametrize("method_name, out_comp", |
|
681 | [("geo2apex", |
|
682 | (55.94841766357422, 94.10684204101562)), |
|
683 | ("apex2geo", |
|
684 | (51.476322174072266, -66.22817993164062, |
|
685 | 5.727287771151168e-06)), |
|
686 | ("geo2qd", |
|
687 | (56.531288146972656, 94.10684204101562)), |
|
688 | ("apex2qd", (60.498401178276744, 15.0)), |
|
689 | ("qd2apex", (59.49138097045895, 15.0))]) |
|
690 | def test_method_scalar_input(self, method_name, out_comp): |
|
691 | """Test the user method against set values with scalars. |
|
692 | ||
693 | Parameters |
|
694 | ---------- |
|
695 | method_name : str |
|
696 | Apex class method to be tested |
|
697 | out_comp : tuple of floats |
|
698 | Expected output values |
|
699 | ||
700 | """ |
|
701 | # Get the desired methods |
|
702 | user_method = getattr(self.apex_out, method_name) |
|
703 | ||
704 | # Get the user output |
|
705 | user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
|
706 | ||
707 | # Evaluate the user output |
|
708 | np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
|
709 | ||
710 | for out_val in user_out: |
|
711 | assert np.asarray(out_val).shape == (), "output is not a scalar" |
|
712 | return |
|
713 | ||
714 | @pytest.mark.parametrize("in_coord", ["geo", "apex", "qd"]) |
|
715 | @pytest.mark.parametrize("out_coord", ["geo", "apex", "qd"]) |