Code Duplication    Length = 15-17 lines in 2 locations

tests/test_ne2001.py 2 locations

@@ 72-88 (lines=17) @@
69
    assert len(ne_clumps) == 100
70
    ix = ne_clumps.argmax()
71
    assert ne_clumps[ix] == clumps.ne_clumps(xyz[:, ix])
72
73
74
def test_void():
75
    voids_file = os.path.join(os.path.split(density.__file__)[0], "data",
76
                              "nevoidN.NE2001.dat")
77
78
    voids = density.Voids(voids_file)
79
80
    voids = density.Voids()
81
82
    xyz = (voids.xyz.T[randint(0, voids.gl.size, 100)].T +
83
           (1-2*rand(3, 100))*0.01)
84
85
    ne_voids = voids.ne_voids(xyz)
86
    assert len(ne_voids) == 100
87
88
    ix = ne_voids.argmax()
89
    assert ne_voids[ix] == voids.ne_voids(xyz[:, ix])
90
91
@@ 55-69 (lines=15) @@
52
    center = rand(3)*20
53
    assert len(density.in_cylinder(xyz, center, cylinder, theta)) == 100
54
55
    assert all(density.in_half_sphere(xyz, center, 10)[xyz[-1] < 0] == 0)
56
57
58
def test_clumps():
59
    clumps_file = os.path.join(os.path.split(density.__file__)[0], "data",
60
                               "neclumpN.NE2001.dat")
61
62
    clumps = density.Clumps(clumps_file)
63
64
    clumps = density.Clumps()
65
    xyz = (clumps.xyz.T[randint(0, clumps.gl.size, 100)].T +
66
           (1-2*rand(3, 100))*0.01)
67
68
    ne_clumps = clumps.ne_clumps(xyz)
69
    assert len(ne_clumps) == 100
70
    ix = ne_clumps.argmax()
71
    assert ne_clumps[ix] == clumps.ne_clumps(xyz[:, ix])
72