def test_confinterval_array_mean(): assert pytest.approx( labmath.confinterval([1, 2, 3], conf=0.5, array_mean=2), (1.528595479208968, 2.4714045207910322)) assert pytest.approx( labmath.confinterval([1, 2, 3], conf=0.5, array_mean=1), (0.528595479209, 1.47140452079))
def test_confinterval_array_mean(self): self._test((1.528595479208968, 2.4714045207910322), labmath.confinterval([1,2,3], conf=0.5, array_mean=2)) expected_ci = (0.528595479209, 1.47140452079) actual_ci = labmath.confinterval([1,2,3], conf=0.5, array_mean=1) self._test(expected_ci[0], actual_ci[0], approximate=True) self._test(expected_ci[0], actual_ci[0], approximate=True)
def test_confinterval_error_only(self): self._test(0.4714045207910322, labmath.confinterval([1,2,3], conf=.5, error_only=True), approximate=True)
def test_confinterval_normal_dist(self): self._test((0.86841426592382809, 3.1315857340761717), labmath.confinterval([1,2,3], normal_threshold=1))
def test_confinterval_c50(self): self._test((1.528595479208968, 2.4714045207910322), labmath.confinterval([1,2,3], conf=0.5))
def test_confinterval_all_same(self): self._test((1, 1), labmath.confinterval([1,1,1,1,1]))
def test_confinterval_123_array(self): self._test((-0.48413771184375287, 4.4841377118437524), labmath.confinterval([1,2,3]))
def test_confinterval_single_item_array(self): self._test((1, 1), labmath.confinterval([1]))
def test_confinterval_empty_array(self): self._test((0, 0), labmath.confinterval([]))
def test_confinterval_error_only(): assert pytest.approx( labmath.confinterval([1, 2, 3], conf=.5, error_only=True), 0.47140452079103223)
def test_confinterval_normal_dist(): assert ((0.86841426592382809, 3.1315857340761717) == labmath.confinterval([1, 2, 3], normal_threshold=1))
def test_confinterval_c50(): assert ((1.528595479208968, 2.4714045207910322) == labmath.confinterval([1, 2, 3], conf=0.5))
def test_confinterval_all_same(): assert ((1, 1) == labmath.confinterval([1, 1, 1, 1, 1]))
def test_confinterval_123_array(): assert labmath.confinterval([1, 2, 3]) == (-0.48413771184375287, 4.4841377118437524)
def test_confinterval_single_item_array(): assert (1, 1) == labmath.confinterval([1])
def test_confinterval_empty_array(): assert (0, 0) == labmath.confinterval([])