def test_charge_methyl_carbocation(): """Test the charge.""" molecule = Molecule([AtomSpec('C', 3, 1)], []) assert molecule.charge(0) == 1
def test_charge(): """Test the charge.""" molecule = Molecule([AtomSpec('C')], []) assert molecule.charge(0) == 0
def test_charge_given_invalid(): """Test that invalid atoms raise error when calling charge.""" carb = AtomSpec(6, 4) molecule = Molecule([carb], []) with pytest.raises(ValueError): molecule.charge(1)