message: Factorize cpp and python torus tests implementations
diff: @@ -18,22 +18,16 @@ def test_sphere():
  with pytest.raises(ValueError):
  points.sphere(n_samples = 10, ambient_dim = 2, radius = 1., sample = 'other')
  -def test_torus():
  - assert points.ctorus(n_samples = 64, dim = 3, sample = 'random').shape == (64, 6)
  - assert points.ctorus(n_samples = 64, dim = 3, sample = 'grid').shape == (64, 6)
  +def _basic_torus(impl):
  + assert impl(n_samples = 64, dim = 3, sample = 'random').shape == (64, 6)
  + assert impl(n_samples = 64, dim = 3, sample = 'grid').shape == (64, 6)
  - assert points.ctorus(n_samples = 10, dim = 4, sample = 'random').shape == (10, 8)
  - assert points.ctorus(n_samples = 10, dim = 4, sample = 'grid').shape == (1, 8)
  + assert impl(n_samples = 10, dim = 4, sample = 'random').shape == (10, 8)
  + assert impl(n_samples = 10, dim = 4, sample = 'grid').shape == (1, 8)
  with pytest.raises(ValueError):
  - points.ctorus(n_samples = 10, dim = 4, sample = 'other')
  -
  -def test_torus_full_python():
  - assert points.torus(n_samples = 64, dim = 3, sample = 'random').shape == (64, 6)
  - assert points.torus(n_samples = 64, dim = 3, sample = 'grid').shape == (64, 6)
  -
  - assert points.torus(n_samples = 10, dim = 4, sample = 'random').shape == (10, 8)
  - assert points.torus(n_samples = 10, dim = 4, sample = 'grid').shape == (1, 8)
  + impl(n_samples = 10, dim = 4, sample = 'other')
  - with pytest.raises(ValueError):
  - points.torus(n_samples = 10, dim = 4, sample = 'other')
  +def test_torus():
  + for torus_impl in [points.torus, points.ctorus]:
  + _basic_torus(torus_impl)
  