def test_particle_dist__bad_particle2(): try: p = Particle(1., 2., 2., 2., 2.) p2 = "wrong" p.dist(p2) except TypeError: pass
def test_particle_dist(): p = Particle(1., 2., 2., 2., 2.) p2 = Particle(1., 5., 6., 2., 2.) p3 = Particle(1., 2., 6., 2., 2.) assert p.dist(p2) == 5.0 assert p2.dist(p) == 5.0 assert p.dist(p3) == 4.0 assert p3.dist(p) == 4.0 assert p2.dist(p3) == 3.0 assert p3.dist(p2) == 3.0