Exemple #1
0
def test_gen_matches_file():
    if sys.version_info[0] == 2:
        pytest.skip
    pytest.importorskip('igraph')
    g_7 = ef.Generator(dmax=7)
    g_7_default = ef.Generator(dmax=7, filename='default')
    assert np.all(g_7_default.specs == g_7.specs)
           [0, 0, 0, 0, 0, 6, 29, 110, 348, 969, 2445],
           [0, 0, 0, 0, 0, 0, 11, 70, 339, 1318, 4457],
           [0, 0, 0, 0, 0, 0, 0, 23, 185, 1067, 4940],
           [0, 0, 0, 0, 0, 0, 0, 0, 47, 479, 3294],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 1279],
           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 235]]


def test_gen_matches_file():
    pytest.importorskip('igraph')
    g_7 = ef.Generator(dmax=7)
    g_7_default = ef.Generator(dmax=7, filename='default')
    assert np.all(g_7_default.specs == g_7.specs)


g_10_default = ef.Generator(dmax=10, filename='default')

sp = g_10_default.specs
c_sp = g_10_default.c_specs


def test_table2a():
    for d in range(1, 8 + 1):
        num_prime = np.count_nonzero(c_sp[:, g_10_default.d_ind] == d)
        num_comp = np.count_nonzero(sp[:, g_10_default.d_ind] == d)
        assert num_prime == table2a['prime'][d]
        assert num_comp == table2a['comp'][d]


def test_table2b():
    for d in range(8 + 1):