def test_bond_check():
    bond1 = 1.4
    bond2 = 1.7

    observed1 = ga.bond_check(bond1)
    observed2 = ga.bond_check(bond2)

    assert observed1 == True
    assert observed2 == False
Exemple #2
0
def test_bond_check_false():
    bond_len = 1.2
    min = 0
    max = 1.0
    observed = ga.bond_check(bond_len, min, max)

    assert observed == False
def test_bond_check():
    distance = 0.3

    expected = True
    observed = ga.bond_check(distance)

    assert observed == expected
def test_bond_check():
    distance = 1
    minimum = 0
    maximum = 1.5

    expected = True
    oberved = ga.bond_check(distance, minimum, maximum)
    assert oberved == expected
def test_bond_check_true():
    bond1 = 0.9
    minimum_value = 0
    maximum_value = 1.5

    observed = ga.bond_check(bond1, minimum_value, maximum_value)

    assert observed == True
def test_bond_check_false():
    bond1 = 17.0
    minimum_value = 0
    maximum_value = 1.5

    observed = ga.bond_check(bond1, minimum_value, maximum_value)

    assert observed == False
Exemple #7
0
def test_bond_check():
    expected = True
    observed = ga.bond_check(5, min_d=3, max_d=6)  #changing fxn arguments
    assert observed == expected


# Misc. Notes
# Run pytest -v
# The “-v” flag stands for verbose. It tells pytest to print more information when it runs the tests.
Exemple #8
0
def test_bond_check_false():

    bond_length = 3.0
    observed = ga.bond_check(bond_length)
    assert observed == False
Exemple #9
0
def test_bond_check():
    atom_distance = 1.5
    expected = True
    observed = ga.bond_check(atom_distance)
    assert observed == expected
def test_bond_check_1_5():
    bond_distance = 1.5
    expected = True
    observed = ga.bond_check(bond_distance)
    assert observed == expected
    if atom_distance > minimum_length and atom_distance <= maximum_length:
        return True
    else:
        return False

def test_bond_check_negative():
    distance = -1
    expected = False
    calculated = ga.bond_check(distance)
    assert expected == calculated

def test_bond_check_negative():
    distance = -1
    expected = False
    with pytest.raises(ValueError)
        calculated = ga.bond_check(distance)


#Write an exception into your open_xyz function where you check the file extension of the file name. Raise a ValueError if the file extension is not .xyz. Write a test to go with your new value error.
def open_xyz(filename):
    fpath, extension = os.path.splitext(filename)

    if extension.lower() != '.xyz':
        raise ValueError("Incorrect file type! File must be type xyz")

    xyz_file = numpy.genfromtxt(fname=filename, skip_header=2, dtype='unicode')
    symbols = xyz_file[:,0]
    coord = (xyz_file[:,1:])
    coord = coord.astype(numpy.float)
    return symbols, coord
def test_bond_check_edge_2_5():
    atom_distance = 2.5
    expected = False
    observed = ga.bond_check(atom_distance)
    assert observed == expected
Exemple #13
0
def test_bond_check_true():
    bond_len = 1.2
    observed = ga.bond_check(bond_len)

    assert observed == True
def test_bond_check():
    bond_distance_test = 2.0

    observed2 = ga.bond_check(bond_distance_test)

    assert observed2 == False
Exemple #15
0
def test_bond_check_negative():
    distance = -1
    expected = False
    with pytest.raises(ValueError):
        oberved = ga.bond_check(distance)
def test_bond_check_negative2():
    atom_distance = -1
    expected = False
    with pytest.raises(ValueError):
        calculated = ga.bond_check(distance)
    assert observed == calculated
def test_bond_check_negative1():
    atom_distance = -1
    expected = False
    observed = ga.bond_check(atom_distance)
    assert observed == expected
Exemple #18
0
def test_bond_check_true():

    bond_length = 1.4
    observed = ga.bond_check(bond_length)
    assert observed == True
Exemple #19
0
def test_bond_check_false():
    atom_distance = 2
    expected = False
    observed = ga.bond_check(atom_distance)
    assert observed == expected
def test_bond_check_false():
    big_dist = 1.7

    big_obs = ga.bond_check(big_dist)
    assert big_obs == False
Exemple #21
0
def test_bond_check_error():
    bond_length = 'a'

    with pytest.raises(TypeError):
        observed = ga.bond_check(bond_length)
def test_bond_check_1p6():
    distance = 1.6
    expected = False
    observed = ga.bond_check(distance)
    assert observed == expected
def test_bond_check_true():
    gud_dist = 1.2

    gud_obs = ga.bond_check(gud_dist)
    assert gud_obs == True
def test_bond_check_false():
    """A test for the bond check function"""
    bond_length = 3.0
    observed = ga.bond_check(bond_length)
    assert observed == False
def test_bond_check_1p6():
    bond_distance = 1.6
    expected = False
    observed = ga.bond_check(bond_distance)

    assert expected == observed
def test_bond_check_true():
    """A test for the bond check function"""
    bond_length = 1.4
    observed = ga.bond_check(bond_length)
    assert observed == True
def test_bond_check_0():
    bond_distance = 0
    expected = False
    observed = ga.bond_check(bond_distance)
    assert observed == expected
Exemple #28
0
def test2_bond_check():
    atom_distance = 1.6 
    expected = False
    observed = ga.bond_check(atom_distance)
    assert observed == expected
def test_bond_check_negative():
    distance = -1
    expected = False
    calculated = ga.bond_check(distance)
    assert expected == calculated
Exemple #30
0
def test_bond_check_true():
    bond_distance = 1.4
    min = 0
    max = 1.5
    observed = ga.bond_check(bond_distance, min, max)
    assert observed == True