def test_compute_breakdata_2(self): funs = np.array([self.fun0, self.fun1]) breaks = compute_breakdata(funs) x, y = list(breaks.keys()), list(breaks.values()) self.assertLessEqual(infnorm(x-np.array([-1,0,1])), eps) self.assertLessEqual(infnorm(y-np.array([np.exp(-1),np.exp(0), np.exp(1)])), 2*eps)
def test_compute_breakdata_1(self): funs = np.array([self.fun0]) breaks = compute_breakdata(funs) x, y = list(breaks.keys()), list(breaks.values()) self.assertLessEqual(infnorm(x - np.array([-1, 0])), eps) self.assertLessEqual( infnorm(y - np.array([np.exp(-1), np.exp(0)])), 2 * eps)
def test_compute_breakdata_2(self): funs = array([self.fun0, self.fun1]) breaks = compute_breakdata(funs) x, y = list(breaks.keys()), list(breaks.values()) self.assertLessEqual(infnorm(x - array([-1, 0, 1])), eps) self.assertLessEqual( infnorm(y - array([exp(-1), exp(0), exp(1)])), 2 * eps)
def test_compute_breakdata_empty(self): breaks = compute_breakdata(np.array([])) # list(...) for Python 2/3 compatibility self.assertTrue(np.array(list(breaks.items())).size == 0)
def __init__(self, funs): self.funs = check_funs(funs) self.breakdata = compute_breakdata(self.funs) self.transposed = False
def test_compute_breakdata_empty(self): breaks = compute_breakdata(np.array([])) # list(...) for Python 2/3 compatibility self.assertTrue(np.array(list(breaks.items())).size==0)