def water_molecule(): name = 'water' symbols = ['H', 'O', 'H'] coordinates = np.array([[2, 0, 0], [0, 0, 0], [-2, 0, 0]]) water = geometry_analysis.Molecule(name, symbols, coordinates) return water
def test_create_failuture(): name = 25 symbols = ["H", "H", "O"] coordinates = np.zeros([3, 3]) with pytest.raises(TypeError): water = geometry_analysis.Molecule(name, symbols, coordinates)
def water_molecule(): name = "water" symbols = ["H", "O", "H"] coordinates = np.array([[2, 0, 0], [0, 0, 0], [-2, 0, 0]]) water = geometry_analysis.Molecule(name, symbols, coordinates) return water
def test_create_failure(): #this function tests if an error is raised name = 25 symbols = ["H", "O", "H"] coordinates = np.zeros([3, 3]) with pytest.raises(TypeError): #we know what the error would be water = geometry_analysis.Molecule(name, symbols, coordinates)
def test_molecules_set_coord(): name = 25 # this will be an error symbols = ['H', 'O', 'H'] coordinates = np.array([[2, 0, 0], [0, 0, 0], [-2, 0, 0]]) # Test that the probe actualy rises an error with pytest.raises(TypeError): water = geometry_analysis.Molecule(name, symbols, coordinates)
def test_create_failure(): name = 25 symbols = ["H", "O", "H"] coordinates = np.zeros([3, 3]) ## Intentional fail becaause name isn't string with pytest.raises(TypeError): water = geometry_analysis.Molecule(name, symbols, coordinates)
def test_create_failure(): name = 25 symbols = ["H", "O", "H"] coordinates = np.array([[1.43, 0, 0.83], [0,0,0], [-1.43, 0, 0.83]]) with pytest.raises(TypeError): water_molecule = geometry_analysis.Molecule(name, symbols, coordinates)
def test_create_failure(): """Test to see if passing incorrect type raises errors """ coordinates = np.array([[2, 0, 0], [0, 0, 0], [-2, 0, 0]]) with pytest.raises( TypeError ): #This ensures that a TypeError being raised results in a PASS, since that's what we want the code to do. name = 25 symbols = ["H", "O", "H"] water = geometry_analysis.Molecule(name, symbols, coordinates)
def test_butane_bonds(butane_molecule): my_molecule = geometry_analysis.Molecule("butane", butane_molecule[0].symbols, butane_molecule[0].geometry ) known_bonds = butane_molecule[0].connectivity calculated_bonds = my_molecule.bonds calculated_keys = list(my_molecule.bonds.keys()) assert len(known_bonds) == len(calculated_bonds) for i in range(len(known_bonds)): assert known_bonds[i][:2] == calculated_keys[i]