예제 #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)
예제 #2
0
def test_num_loops_3():
    amat = bonding.build_adjmat(*eg.p4)
    assert bonding.num_loops(amat, 3) == 4
예제 #3
0
def test_num_loops_4():
    amat = bonding.build_adjmat(*eg.c4h4)
    assert bonding.num_loops(amat, 4) == 1
예제 #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)
예제 #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)
예제 #6
0
def test_build_adjmat_lothresh():
    amat = bonding.build_adjmat(*eg.h2, lothresh=0.8)
    assert np.all(amat == 0)
예제 #7
0
def test_build_adjmat_lothresh():
    amat = bonding.build_adjmat(*eg.h2, lothresh=0.8)
    assert np.all(amat == 0)
예제 #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)
예제 #9
0
def test_build_adjmat_default():
    amat = bonding.build_adjmat(*eg.h2)
    assert np.all(amat == np.array([[0, 1], [1, 0]]))
예제 #10
0
def test_num_loops_4():
    amat = bonding.build_adjmat(*eg.c4h4)
    assert bonding.num_loops(amat, 4) == 1
예제 #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)
예제 #12
0
def test_num_loops_3():
    amat = bonding.build_adjmat(*eg.p4)
    assert bonding.num_loops(amat, 3) == 4
예제 #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)
예제 #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)
예제 #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)
예제 #16
0
def test_build_adjmat_error():
    amat = bonding.build_adjmat(*eg.h2, error=0.)
    assert np.all(amat == 0)
예제 #17
0
def test_build_adjmat_default():
    amat = bonding.build_adjmat(*eg.h2)
    assert np.all(amat == np.array([[0, 1], [1, 0]]))
예제 #18
0
def test_build_adjmat_error():
    amat = bonding.build_adjmat(*eg.h2, error=0.)
    assert np.all(amat == 0)