Code Duplication    Length = 18-18 lines in 2 locations

aacgmv2/tests/test_c_aacgmv2.py 2 locations

@@ 70-87 (lines=18) @@
67
68
        del lat_comp, lon_comp, r_comp
69
70
    def test_convert_A2G_coeff(self):
71
        """Test convert from magnetic to geodetic coordinates"""
72
        lat_comp = [30.7534, 50.3910]
73
        lon_comp = [-94.1806, -77.7919]
74
        r_comp = [1133.6241, 305.7138]
75
76
        for i,darg in enumerate(self.date_args):
77
            aacgmv2._aacgmv2.set_datetime(*darg)
78
            (self.mlat, self.mlon,
79
             self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[i],
80
                                                     self.lon_in[i],
81
                                                     self.alt_in[i],
82
                                                     aacgmv2._aacgmv2.A2G)
83
            np.testing.assert_almost_equal(self.mlat, lat_comp[i], decimal=4)
84
            np.testing.assert_almost_equal(self.mlon, lon_comp[i], decimal=4)
85
            np.testing.assert_almost_equal(self.rshell, r_comp[i], decimal=4)
86
87
        del lat_comp, lon_comp, r_comp
88
89
    def test_convert_arr(self):
90
        """Test convert_arr using from magnetic to geodetic coordinates"""
@@ 51-68 (lines=18) @@
48
        with pytest.raises(RuntimeError):
49
            aacgmv2._aacgmv2.set_datetime(1013, 1, 1, 0, 0, 0)
50
51
    def test_convert_G2A_coeff(self):
52
        """Test convert from geographic to magnetic coordinates"""
53
        lat_comp = [48.1896, 58.1633]
54
        lon_comp = [57.7635, 81.0719]
55
        r_comp = [1.1775, 1.0457]
56
57
        for i,darg in enumerate(self.date_args):
58
            aacgmv2._aacgmv2.set_datetime(*darg)
59
            (self.mlat, self.mlon,
60
             self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[i],
61
                                                     self.lon_in[i],
62
                                                     self.alt_in[i],
63
                                                     aacgmv2._aacgmv2.G2A)
64
            np.testing.assert_almost_equal(self.mlat, lat_comp[i], decimal=4)
65
            np.testing.assert_almost_equal(self.mlon, lon_comp[i], decimal=4)
66
            np.testing.assert_almost_equal(self.rshell, r_comp[i], decimal=4)
67
68
        del lat_comp, lon_comp, r_comp
69
70
    def test_convert_A2G_coeff(self):
71
        """Test convert from magnetic to geodetic coordinates"""