Ejemplo n.º 1
0
    def test_bond_parity_given_invalid():
        """
        Test that invalid bonds raise error when calling bond_parity.

        """
        carb_3 = AtomSpec(6, 3)
        bond = BondSpec(0, 1, 1)
        molecule = Molecule([carb_3, carb_3], [bond])
        with pytest.raises(ValueError):
            molecule.bond_parity(1, 2)
        with pytest.raises(ValueError):
            molecule.bond_parity(2, 0)
Ejemplo n.º 2
0
    def test_given_bond_parity():
        """Test a given bond parity."""
        carb_3 = AtomSpec(6, 3)
        carb_1 = AtomSpec(6, 1)

        atoms = [carb_3, carb_1, carb_1, carb_3]
        bonds = [
            BondSpec(0, 1, BondOrder(1)),
            BondSpec(1, 2, BondOrder(2), True),
            BondSpec(2, 3, BondOrder(1)),
        ]

        molecule = Molecule(atoms, bonds)
        assert molecule.bond_parity(1, 2) == Parity(True)
Ejemplo n.º 3
0
    def test_given_bond_parity():
        """Test a given bond parity."""
        carb = AtomSpec(6)
        hyd = AtomSpec(1)

        atoms = [carb, hyd, hyd, carb, hyd, hyd]
        bonds = [
            BondSpec(0, 1, BondOrder(1)),
            BondSpec(0, 2, BondOrder(1)),
            BondSpec(0, 3, BondOrder(2), True),
            BondSpec(3, 4, BondOrder(1)),
            BondSpec(3, 5, BondOrder(1))
        ]

        molecule = Molecule(atoms, bonds)
        assert molecule.bond_parity(0, 3) == Parity(True)
Ejemplo n.º 4
0
    def test_bond_parity():
        """Test the bond parity."""
        carb = AtomSpec(6)
        hyd = AtomSpec(1)

        atoms = [carb, hyd, hyd, carb, hyd, hyd]
        bonds = [
            BondSpec(0, 1, BondOrder(1)),
            BondSpec(0, 2, BondOrder(1)),
            BondSpec(0, 3, BondOrder(2)),
            BondSpec(3, 4, BondOrder(1)),
            BondSpec(3, 5, BondOrder(1))
        ]

        molecule = Molecule(atoms, bonds)
        assert molecule.bond_parity(0, 3) is None