Skip to content

Commit c45145f

Browse files
committed
Fixed tests
1 parent 7d8c94a commit c45145f

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

advection/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def dovis(self):
128128
particle_positions = self.particles.get_positions()
129129

130130
# dye particles
131-
colors = self.particles.get_init_positions()[:,0]
131+
colors = self.particles.get_init_positions()[:, 0]
132132

133133
# plot particles
134134
ax.scatter(particle_positions[:, 0],

particles/particles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def get_init_positions(self):
269269
We defined the particles as a dictionary with their initial positions
270270
as the keys, so this just becomes a restructuring operation.
271271
"""
272-
return np.array([[x, y] for (x,y) in self.particles.keys()])
272+
return np.array([[x, y] for (x, y) in self.particles.keys()])
273273

274274
def write_particles(self, filename):
275275
"""

particles/tests/test_particles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_particles_random_gen():
4040
np.random.seed(3287469)
4141

4242
ps = particles.Particles(sim.cc_data, bc, rp)
43-
positions = set([(p.x, p.y) for p in ps.particles])
43+
positions = set([(p.x, p.y) for p in ps.particles.values()])
4444

4545
assert len(ps.particles) == 50, "There should be 50 particles"
4646

@@ -76,7 +76,7 @@ def test_particles_grid_gen():
7676

7777
assert len(ps.particles) == 49, "There should be 49 particles"
7878

79-
positions = set([(p.x, p.y) for p in ps.particles])
79+
positions = set([(p.x, p.y) for p in ps.particles.values()])
8080

8181
xs, step = np.linspace(0, 1, num=7, endpoint=False, retstep=True)
8282
xs += 0.5 * step

swe/tests/test_swe.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def setup_method(self):
2222

2323
self.rp.params["mesh.nx"] = 8
2424
self.rp.params["mesh.ny"] = 8
25+
self.rp.params["particles.do_particles"] = 0
2526

2627
self.rp.params["swe.grav"] = 1.0
2728

0 commit comments

Comments
 (0)