Code Duplication    Length = 13-14 lines in 2 locations

metpy/calc/tests/test_tools.py 2 locations

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