def test_particles_snapshot(self): particles = Particles("test") random.seed(42) for i in range(0, 1000): p = Particle(coordinates=(random.uniform(0.0, 10.0), random.uniform(0.0, 10.0), random.uniform(0.0, 10.0))) particles.add_particles([p]) snapshot(particles, self.filename) self.assertTrue(os.path.exists(self.filename)) image = Image.open(self.filename) self.assertTrue(image.size) self.assertTrue(image.size[0] > 0 and image.size[1] > 0)
def test_unknown_container(self): container = object() with self.assertRaises(TypeError): snapshot(container, "fail.png")
def test_mesh_snapshot(self): mesh = Mesh('test') with self.assertRaises(TypeError): snapshot(mesh, "fail.png")
def test_lattice_snapshot(self): lattice = create_lattice() with self.assertRaises(TypeError): snapshot(lattice, "fail.png")