def setUp(self): self.path1 = Path([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-0.3, 0.4)]) self.path2 = Path([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-3, 4)]) self.contours1 = Contours([(-0.3, 0.4, 1), (-0.3, 0.3, 1), (-0.2, 0.3, 1), (-0.2, 0.4, 1), (-0.3, 0.4, 1)], vdims='Level') self.contours2 = Contours([(-0.3, 0.4, 1), (-0.3, 0.3, 1), (-0.2, 0.3, 1), (-0.2, 0.4, 1), (-3, 4, 1)], vdims='Level') self.contours3 = Contours([(-0.3, 0.4, 2), (-0.3, 0.3, 2), (-0.2, 0.3, 2), (-0.2, 0.4, 2), (-0.3, 0.4, 2)], vdims='Level') self.bounds1 = Bounds(0.3) self.bounds2 = Bounds(0.4) self.box1 = Box(-0.25, 0.3, 0.3) self.box2 = Box(-0.25, 0.3, 0.4) self.ellipse1 = Ellipse(-0.25, 0.3, 0.3) self.ellipse2 = Ellipse(-0.25, 0.3, 0.4)
def setUp(self): self.path1 = Path([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-0.3, 0.4)]) self.path2 = Path([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-3, 4)]) self.contours1 = Contours([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-0.3, 0.4)], level=1) self.contours2 = Contours([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-3, 4)], level=1) self.contours3 = Contours([(-0.3, 0.4), (-0.3, 0.3), (-0.2, 0.3), (-0.2, 0.4), (-0.3, 0.4)], level=2) self.bounds1 = Bounds(0.3) self.bounds2 = Bounds(0.4) self.box1 = Box(-0.25, 0.3, 0.3) self.box2 = Box(-0.25, 0.3, 0.4) self.ellipse1 = Ellipse(-0.25, 0.3, 0.3) self.ellipse2 = Ellipse(-0.25, 0.3, 0.4)
def test_ellipse_simple_constructor_squashed_aspect(self): ellipse = Ellipse(0,0,2, aspect=0.5, samples=6) self.assertEqual(np.allclose(ellipse.data[0], self.squashed), True)
def test_ellipse_tuple_constructor_squashed(self): ellipse = Ellipse(0,0,(1,2), samples=6) self.assertEqual(np.allclose(ellipse.data[0], self.squashed), True)
def test_ellipse_simple_constructor_pentagon(self): ellipse = Ellipse(0,0,1, samples=6) self.assertEqual(np.allclose(ellipse.data[0], self.pentagon), True)
def test_ellipse_simple_constructor(self): ellipse = Ellipse(0,0,1, samples=100) self.assertEqual(len(ellipse.data[0]), 100)