def random_vec2(): return Vec2(self.random_scalar(), self.random_scalar())
def test_scalar_division(self): self.approx_equal_vec2(Vec2(10, -4.4) / 2, Vec2(5, -2.2))
def test_add_between_classes_2(self): with self.assertRaises( TypeError, msg='should raise TypeError when not compatible class'): Vec3(1, 2, 3) + Vec2(1, 2)
def test_eq_between_classes(self): self.assertFalse(Vec2(1, 2) == Vec3(1, 2, 3)) self.assertFalse(Vec3(1, 2, 3) == Vec2(1, 2))
def test_negate_vector(self): self.assertEqual(-Vec2(-1, 2), Vec2(1, -2))
def test_zero_vector(self): self.assertEqual(Vec2.zero(), Vec2(0, 0))