Ejemplo n.º 1
0
def test_atom_hybridization():
    a = Atom(6)
    assert a.get_hybridization() == 0  # unassigned
    a.set_hybridization(3)
    assert a.get_hybridization() == 3  # assigned (here sp3 hybridized)

    with pytest.raises(TypeError):
        a.set_hybridization(1.0)

    with pytest.raises(ValueError):
        a.set_hybridization(0)

    assert a.get_hybridization() == 3  # check nothing has changed
Ejemplo n.º 2
0
def test_atom_copy():
    a1 = Atom(1, xyz=[0.0, 0.0, 1.0], idx=1, hybridization=3)
    a2 = Atom.from_atom(a1)

    assert a1 == a2
    assert a1.get_hybridization() == a2.get_hybridization()