Code Duplication    Length = 13-14 lines in 2 locations

metpy/calc/tests/test_tools.py 2 locations

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