Esempio n. 1
0
def test_num_loops_less_than_3():
    amat = bonding.build_adjmat(*eg.ch4)
    with pytest.raises(ValueError, match=r'Loops must have 3 .*'):
        bonding.num_loops(amat, 2)
Esempio n. 2
0
def test_num_loops_3():
    amat = bonding.build_adjmat(*eg.p4)
    assert bonding.num_loops(amat, 3) == 4
Esempio n. 3
0
def test_num_loops_4():
    amat = bonding.build_adjmat(*eg.c4h4)
    assert bonding.num_loops(amat, 4) == 1
Esempio n. 4
0
def test_path_len():
    amat = bonding.build_adjmat(*eg.ch4)
    soln = np.ones(5, dtype=int) - np.eye(5, dtype=int)
    soln[0, :] = 0
    soln[:, 0] = 0
    assert np.all(bonding.path_len(amat, 2) == soln)
Esempio n. 5
0
def test_num_neighbours():
    amat = bonding.build_adjmat(*eg.ch4)
    soln = np.array([0, 3, 3, 3, 3])
    assert np.all(bonding.num_neighbours(amat, 2) == soln)
Esempio n. 6
0
def test_build_adjmat_lothresh():
    amat = bonding.build_adjmat(*eg.h2, lothresh=0.8)
    assert np.all(amat == 0)
Esempio n. 7
0
def test_build_adjmat_lothresh():
    amat = bonding.build_adjmat(*eg.h2, lothresh=0.8)
    assert np.all(amat == 0)
Esempio n. 8
0
def test_num_loops_more_than_3():
    amat = bonding.build_adjmat(*eg.ch4)
    with pytest.raises(ValueError, match=r'Loops of more than 4 .*'):
        bonding.num_loops(amat, 5)
Esempio n. 9
0
def test_build_adjmat_default():
    amat = bonding.build_adjmat(*eg.h2)
    assert np.all(amat == np.array([[0, 1], [1, 0]]))
Esempio n. 10
0
def test_num_loops_4():
    amat = bonding.build_adjmat(*eg.c4h4)
    assert bonding.num_loops(amat, 4) == 1
Esempio n. 11
0
def test_num_loops_less_than_3():
    amat = bonding.build_adjmat(*eg.ch4)
    with pytest.raises(ValueError, match=r'Loops must have 3 .*'):
        bonding.num_loops(amat, 2)
Esempio n. 12
0
def test_num_loops_3():
    amat = bonding.build_adjmat(*eg.p4)
    assert bonding.num_loops(amat, 3) == 4
Esempio n. 13
0
def test_num_neighbours():
    amat = bonding.build_adjmat(*eg.ch4)
    soln = np.array([0, 3, 3, 3, 3])
    assert np.all(bonding.num_neighbours(amat, 2) == soln)
Esempio n. 14
0
def test_path_len():
    amat = bonding.build_adjmat(*eg.ch4)
    soln = np.ones(5, dtype=int) - np.eye(5, dtype=int)
    soln[0,:] = 0
    soln[:,0] = 0
    assert np.all(bonding.path_len(amat, 2) == soln)
Esempio n. 15
0
def test_num_loops_more_than_3():
    amat = bonding.build_adjmat(*eg.ch4)
    with pytest.raises(ValueError, match=r'Loops of more than 4 .*'):
        bonding.num_loops(amat, 5)
Esempio n. 16
0
def test_build_adjmat_error():
    amat = bonding.build_adjmat(*eg.h2, error=0.)
    assert np.all(amat == 0)
Esempio n. 17
0
def test_build_adjmat_default():
    amat = bonding.build_adjmat(*eg.h2)
    assert np.all(amat == np.array([[0, 1], [1, 0]]))
Esempio n. 18
0
def test_build_adjmat_error():
    amat = bonding.build_adjmat(*eg.h2, error=0.)
    assert np.all(amat == 0)