Code Duplication    Length = 13-14 lines in 2 locations

metpy/calc/tests/test_tools.py 2 locations

@@ 138-151 (lines=14) @@
135
    r"""Test that reduce_point_density works."""
136
    assert_array_equal(reduce_point_density(thin_point_data, radius=radius), truth)
137
138
139
@pytest.mark.parametrize('radius, truth',
140
                         [(2.0, np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
141
                                          0, 0, 0, 0, 0, 0, 0, 0, 0, 1], dtype=np.bool)),
142
                          (0.7, np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
143
                                          0, 0, 0, 1, 0, 0, 0, 0, 0, 1], dtype=np.bool)),
144
                          (0.3, np.array([1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0,
145
                                          0, 0, 0, 1, 0, 0, 0, 1, 0, 1], dtype=np.bool)),
146
                          (0.1, np.array([1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
147
                                          0, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=np.bool))
148
                          ])
149
def test_reduce_point_density_priority(thin_point_data, radius, truth):
150
    r"""Test that reduce_point_density works properly with priority."""
151
    key = np.array([8, 6, 2, 8, 6, 4, 4, 8, 8, 6, 3, 4, 3, 0, 7, 4, 3, 2, 3, 3, 9])
152
    assert_array_equal(reduce_point_density(thin_point_data, radius, key), truth)
153
154
@@ 123-135 (lines=13) @@
120
                   [0.5591604, 0.5579290], [0.1284860, 0.0968003], [0.2857064, 0.3862123]])
121
    return xy
122
123
124
@pytest.mark.parametrize('radius, truth',
125
                         [(2.0, np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126
                                          0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=np.bool)),
127
                          (1.0, np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
128
                                          0, 0, 0, 0, 0, 0, 0, 0, 1, 0], dtype=np.bool)),
129
                          (0.3, np.array([1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0,
130
                                          0, 0, 0, 0, 0, 1, 0, 0, 0, 0], dtype=np.bool)),
131
                          (0.1, np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
132
                                          0, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=np.bool))
133
                          ])
134
def test_reduce_point_density(thin_point_data, radius, truth):
135
    r"""Test that reduce_point_density works."""
136
    assert_array_equal(reduce_point_density(thin_point_data, radius=radius), truth)
137
138