Code Duplication    Length = 12-15 lines in 3 locations

aacgmv2/tests/test_dep_aacgmv2.py 3 locations

@@ 138-152 (lines=15) @@
135
        np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4)
136
        np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4)
137
138
    def test_convert_arr(self):
139
        """Test conversion for array input"""
140
        
141
        with warnings.catch_warnings():
142
            warnings.simplefilter("ignore")
143
            self.lat, self.lon = aacgmv2.convert(np.array([60, 61]),
144
                                                 np.array([0, 0]),
145
                                                 np.array([300, 300]),
146
                                                 self.dtime)
147
148
        assert isinstance(self.lat, np.ndarray)
149
        assert isinstance(self.lon, np.ndarray)
150
        assert self.lat.shape == self.lon.shape and self.lat.shape == (2,)
151
        np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4)
152
        np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4)
153
154
    def test_convert_list_mix(self):
155
        """Test conversion for a list and floats"""
@@ 167-178 (lines=12) @@
164
        np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4)
165
        np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4)
166
167
    def test_convert_arr_mix(self):
168
        """Test conversion for an array and floats"""
169
        with warnings.catch_warnings():
170
            warnings.simplefilter("ignore")
171
            self.lat, self.lon = aacgmv2.convert(np.array([60, 61]), 0, 300,
172
                                                 self.dtime)
173
174
        assert isinstance(self.lat, np.ndarray)
175
        assert isinstance(self.lon, np.ndarray)
176
        assert self.lat.shape == self.lon.shape and self.lat.shape == (2,)
177
        np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4)
178
        np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4)
179
180
    def test_convert_mult_array_mix(self):
181
        """Test conversion for a multi-dim array and floats"""
@@ 125-136 (lines=12) @@
122
        np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4)
123
        np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4)
124
125
    def test_convert_arr_single(self):
126
        """Test conversion for array input with one element"""
127
        with warnings.catch_warnings():
128
            warnings.simplefilter("ignore")
129
            self.lat, self.lon = aacgmv2.convert(np.array([60]), np.array([0]),
130
                                                 np.array([300]), self.dtime)
131
132
        assert isinstance(self.lat, np.ndarray)
133
        assert isinstance(self.lon, np.ndarray)
134
        assert self.lat.shape == self.lon.shape and self.lat.shape == (1,)
135
        np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4)
136
        np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4)
137
138
    def test_convert_arr(self):
139
        """Test conversion for array input"""