Code Duplication    Length = 13-14 lines in 2 locations

metpy/calc/tests/test_tools.py 2 locations

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