def test_add_bond(): m = mx.Molecule() v = mx.Atom() w = mx.Atom() m.add_atom(v) m.add_atom(w) m.add_bond(v, w) assert len(m.bonds()) == 1 assert len(m.atoms()) == 2
def test_atom(): v = mx.Atom(symbol='H') assert v.element.number == 1 assert v.element.symbol == 'H' assert v.element.mass == 1.00800 v = mx.Atom(number=1) assert v.element.number == 1 assert v.element.symbol == 'H' assert v.element.mass == 1.00800
def test_atom_unknown_atom(): with pytest.raises(KeyError): v = mx.Atom(symbol='X')
def test_atom_element_number_mismatch(): with pytest.raises(AssertionError): v = mx.Atom(number=1, symbol='C')
def test_add_atom(): m = mx.Molecule() v = mx.Atom() m.add_atom(v) assert len(m.atoms()) == 1