def test_pseudos(get_pseudo_potential_data): """Test the `PseudoPotentialFamily.pseudos` property.""" pseudos = { 'Ar': get_pseudo_potential_data('Ar').store(), 'He': get_pseudo_potential_data('He').store(), } family = PseudoPotentialFamily(label='label').store() family.add_nodes(list(pseudos.values())) assert family.pseudos == pseudos
def test_pseudo_type(get_pseudo_potential_data): """Test ``PseudoPotentialFamily.pseudo_type`` property.""" family = PseudoPotentialFamily(label='label').store() assert family.pseudo_type is None pseudo = get_pseudo_potential_data('Ar').store() family.add_nodes((pseudo,)) assert family.pseudo_type == pseudo.get_entry_point_name() family.clear() assert family.pseudo_type is None family.add_nodes((pseudo,)) assert family.pseudo_type == pseudo.get_entry_point_name() family.remove_nodes(pseudo) assert family.pseudo_type is None
def test_add_nodes(get_pseudo_family, get_pseudo_potential_data): """Test that `PseudoPotentialFamily.add_nodes` method.""" family = get_pseudo_family(elements=('Rn',)) assert family.count() == 1 pseudos = get_pseudo_potential_data('Ar').store() family.add_nodes(pseudos) assert family.count() == 2 pseudos = (get_pseudo_potential_data('Ne').store(),) family.add_nodes(pseudos) assert family.count() == 3 pseudos = (get_pseudo_potential_data('He').store(), get_pseudo_potential_data('Kr').store()) family.add_nodes(pseudos) assert family.count() == 5 # Test for an unstored family family = PseudoPotentialFamily(label='label') with pytest.raises(exceptions.ModificationNotAllowed): family.add_nodes(pseudos)