Exemple #1
0
def test_sigFigs_bad_n():
    misc.sigFigs(1.234, 0)
Exemple #2
0
def test_sigFigs_baseline_lt1():
    x2 = 0.12345
    nt.assert_equal(misc.sigFigs(x2, 3), '0.123')
    nt.assert_equal(misc.sigFigs(x2, 4), '0.1235')
Exemple #3
0
def test_sigFigs_baseline_lt1():
    x2 = 0.12345
    nt.assert_equal(misc.sigFigs(x2, 3), '0.123')
    nt.assert_equal(misc.sigFigs(x2, 4), '0.1235')
Exemple #4
0
def test_sigFigs_pvals_noop():
    p = 0.001
    nt.assert_equal(misc.sigFigs(p, 1, pval=True), '0.001')
Exemple #5
0
def test_sigFigs_pvals_op_tex():
    p = 0.0005
    nt.assert_equal(misc.sigFigs(p, 3, tex=True, pval=True), '$<0.001$')
Exemple #6
0
def test_sigFigs_exponents_notex_gt1():
    x1 = 123456789.123456789
    nt.assert_equal(misc.sigFigs(x1, 3, tex=False), '1.23e+08')
Exemple #7
0
def test_sigFigs_exponents_tex_gt1():
    x1 = 123456789.123456789
    nt.assert_equal(misc.sigFigs(x1, 3, tex=True), r'$1.23 \times 10 ^ {8}$')
Exemple #8
0
def test_sigFigs_exponents_tex_gt1():
    x1 = 123456789.123456789
    nt.assert_equal(misc.sigFigs(x1, 3, tex=True), r'$1.23 \times 10 ^ {8}$')
Exemple #9
0
def test_sigFigs_exponents_tex_lt1():
    x2 = 0.000000123
    nt.assert_equal(misc.sigFigs(x2, 3, tex=True), r'$1.23 \times 10 ^ {-7}$')
Exemple #10
0
def test_sigFigs_exponents_notex_gt1():
    x1 = 123456789.123456789
    nt.assert_equal(misc.sigFigs(x1, 3, tex=False), '1.23e+08')
Exemple #11
0
def test_sigFigs_exponents_notex_lt1():
    x2 = 0.000000123
    nt.assert_equal(misc.sigFigs(x2, 3, tex=False), '1.23e-07')
Exemple #12
0
def test_sigFigs_trailing_zeros_lt1():
    x2 = 0.12345
    nt.assert_equal(misc.sigFigs(x2, 8), '0.12345000')
Exemple #13
0
def test_sigFigs_trailing_zeros_gt1():
    x1 = 1234.56
    nt.assert_equal(misc.sigFigs(x1, 8), '1,234.5600')
Exemple #14
0
def test_sigFigs_bad_n():
    misc.sigFigs(1.234, 0)
Exemple #15
0
def test_sigFigs_trailing_zeros_gt1():
    x1 = 1234.56
    nt.assert_equal(misc.sigFigs(x1, 8), '1,234.5600')
Exemple #16
0
def test_sigFigs_pvals_noop():
    p = 0.001
    nt.assert_equal(misc.sigFigs(p, 1, pval=True), '0.001')
Exemple #17
0
def test_sigFigs_trailing_zeros_lt1():
    x2 = 0.12345
    nt.assert_equal(misc.sigFigs(x2, 8), '0.12345000')
Exemple #18
0
def test_sigFigs_pvals_op():
    p = 0.0005
    nt.assert_equal(misc.sigFigs(p, 3, pval=True), '<0.001')
Exemple #19
0
def test_sigFigs_exponents_notex_lt1():
    x2 = 0.000000123
    nt.assert_equal(misc.sigFigs(x2, 3, tex=False), '1.23e-07')
Exemple #20
0
def test_sigFigs_pvals_op_tex():
    p = 0.0005
    nt.assert_equal(misc.sigFigs(p, 3, tex=True, pval=True), '$<0.001$')
Exemple #21
0
def test_sigFigs_exponents_tex_lt1():
    x2 = 0.000000123
    nt.assert_equal(misc.sigFigs(x2, 3, tex=True), r'$1.23 \times 10 ^ {-7}$')
Exemple #22
0
def test_sigFigs_exception():
    misc.sigFigs(199, -1)
Exemple #23
0
def test_sigFigs_pvals_op():
    p = 0.0005
    nt.assert_equal(misc.sigFigs(p, 3, pval=True), '<0.001')
Exemple #24
0
def test_sigFigs_baseline_gt1():
    x1 = 1234.56
    nt.assert_equal(misc.sigFigs(x1, 3), '1,230')
    nt.assert_equal(misc.sigFigs(x1, 4), '1,235')
Exemple #25
0
def test_sigFigs_exception():
    misc.sigFigs(199, -1)
Exemple #26
0
def test_sigFigs_baseline_gt1():
    x1 = 1234.56
    nt.assert_equal(misc.sigFigs(x1, 3), '1,230')
    nt.assert_equal(misc.sigFigs(x1, 4), '1,235')