aiida.backends.tests package

aiida.backends.tests.get_db_test_list()[source]

This function returns the db_test_list for the current backend, merged with the ‘common’ tests.

Note:This function should be called only after setting the backend, and then it returns only the tests for this backend, and the common ones.
aiida.backends.tests.get_db_test_names()[source]

Submodules

class aiida.backends.tests.backup_script.TestBackupScriptIntegration(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.backup_script'
_aiida_rel_path = '.aiida'
_backup_rel_path = 'backup'
_bs_instance = <aiida.common.additions.backup_script.backup_setup.BackupSetup object>
_repo_rel_path = 'repository'
create_backup_scripts(tmp_folder)[source]
fill_repo()[source]
test_integration()[source]
class aiida.backends.tests.backup_script.TestBackupScriptUnit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.backup_script'
_json_test_input_1 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_2 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_3 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": null, "days_to_backup": 2, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_4 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": "2014-07-22 14:54:53.688484+00:00", "days_to_backup": null, "backup_dir": "/scratch/aiida_user/backupScriptDest"}'
_json_test_input_5 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484+00:00", "end_date_of_backup": "2014-07-22 14:54:53.688484+00:00", "days_to_backup": 2, "backup_dir": "/scratch/aiida_user/backup"}'
_json_test_input_6 = '{"backup_length_threshold": 2, "periodicity": 2, "oldest_object_backedup": "2014-07-18 13:54:53.688484", "end_date_of_backup": "2014-07-22 14:54:53.688484", "days_to_backup": null, "backup_dir": "/scratch/./aiida_user////backup//"}'
check_full_deserialization_serialization(input_string, backup_inst)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_full_deserialization_serialization_1()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_2()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_3()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_full_deserialization_serialization_4()[source]

This method tests the correct deserialization / serialization of the variables that should be stored in a file.

test_loading_backup_time_params_from_file_1()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, no _backup_setup_inst end limits are set

test_loading_backup_time_params_from_file_2()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, only the daysToBackup limit is set.

test_loading_backup_time_params_from_file_3()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, only the endDateOfBackup limit is set.

test_loading_backup_time_params_from_file_4()[source]

This method tests that the _backup_setup_inst limits are correctly loaded from the JSON string and are correctly set.

In the parsed JSON string, the endDateOfBackup & daysToBackuplimit are set which should lead to an exception.

test_loading_basic_params_from_file()[source]

This method tests the correct loading of the basic _backup_setup_inst parameters from a JSON string.

test_timezone_addition_and_dir_correction()[source]

This method tests if the timezone is added correctly to timestamps that don’t have a timezone. Moreover, it checks if the given directory paths are normalized as expected.

class aiida.backends.tests.backup_setup_script.TestBackupSetupScriptIntegration(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.backup_setup_script'
test_full_backup_setup_script()[source]

This method is a full test of the backup setup script. It launches it, replies to all the question as the user would do and in the end it checks that the correct files were created with the right content.

class aiida.backends.tests.backup_setup_script.TestBackupSetupScriptUnit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.backup_setup_script'
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_construct_backup_variables()[source]

Test that checks that the backup variables are populated as it should by the construct_backup_variables by asking the needed questions. A lambda function is used to simulate the user input.

class aiida.backends.tests.base_dataclasses.TestFloat(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.base_dataclasses'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_add()[source]
test_create()[source]
test_load()[source]
test_mul()[source]
test_power()[source]
class aiida.backends.tests.base_dataclasses.TestFloatIntMix(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.base_dataclasses'
test_operator()[source]
class aiida.backends.tests.base_dataclasses.TestList(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.base_dataclasses'
test_append()[source]
test_creation()[source]
test_extend()[source]
test_mutability()[source]
class aiida.backends.tests.calculation_node.TestCalcNode(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

These tests check the features of Calculation nodes that differ from the base Node type

__module__ = 'aiida.backends.tests.calculation_node'
boolval = True
dictval = {'emptydict': {}, 'num': 3, 'recursive': {'a': 1, 'c': 1.2, 'b': True, 'e': {'yy': [], 'x': None, 'xx': {}, 'z': 'z'}, 'd': [1, 2, None]}, 'something': 'else'}
floatval = 4.56
intval = 123
listval = [1, 's', True, None]
stateval = 'RUNNING'
stringval = 'aaaa'
test_calculation_updatable_attribute()[source]

Check that updatable attributes and only those can be mutated for a stored but unsealed Calculation

test_calculation_updatable_not_copied()[source]

Check that updatable attributes of Calculation are not copied

Tests for the NWChem input plugins.

class aiida.backends.tests.computer.TestComputer(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.computer'
test_delete()[source]
class aiida.backends.tests.daemon.TestDaemonBasic(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.daemon'
test_workflow_fast_kill()[source]

Tests for specific subclasses of Data

class aiida.backends.tests.dataclasses.TestArrayData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the ArrayData objects.

__module__ = 'aiida.backends.tests.dataclasses'
test_creation()[source]

Check the methods to add, remove, modify, and get arrays and array shapes.

test_iteration()[source]

Check the functionality of the iterarrays() iterator

class aiida.backends.tests.dataclasses.TestBandsData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the BandsData objects.

__module__ = 'aiida.backends.tests.dataclasses'
test_band()[source]

Check the methods to set and retrieve a mesh.

test_export_to_file()[source]

Export the band structure on a file, check if it is working

class aiida.backends.tests.dataclasses.TestCalcStatus(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the functionality of calculation states.

__module__ = 'aiida.backends.tests.dataclasses'
test_state()[source]
class aiida.backends.tests.dataclasses.TestCifData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for CifData class.

class StrictVersion(vstring=None)

Bases: distutils.version.Version

Version numbering for anal retentives and software idealists. Implements the standard interface for version number classes as described above. A version number consists of two or three dot-separated numeric components, with an optional “pre-release” tag on the end. The pre-release tag consists of the letter ‘a’ or ‘b’ followed by a number. If the numeric components of two version numbers are equal, then one with a pre-release tag will always be deemed earlier (lesser) than one without.

The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):

0.4 0.4.0 (these two are equivalent) 0.4.1 0.5a1 0.5b3 0.5 0.9.6 1.0 1.0.4a3 1.0.4b1 1.0.4

The following are examples of invalid version numbers:

1 2.7.2.2 1.3.a4 1.3pl1 1.3c4

The rationale for this version numbering system will be explained in the distutils documentation.

__cmp__(other)
__module__ = 'distutils.version'
__str__()
parse(vstring)
version_re = <_sre.SRE_Pattern object>
__module__ = 'aiida.backends.tests.dataclasses'
get_pymatgen_version()
Returns:string with pymatgen version, None if can not import.
has_ase()
Returns:True if the ase module can be imported, False otherwise.
has_pycifrw()
Returns:True if the PyCifRW module can be imported, False otherwise.
has_pymatgen()
Returns:True if the pymatgen module can be imported, False otherwise.
has_spglib()
Returns:True if the spglib module can be imported, False otherwise.
test_ase_primitive_and_conventional_cells_ase()[source]

Checking the number of atoms per primitive/conventional cell returned by ASE ase.io.read() method. Test input is adapted from http://www.crystallography.net/cod/9012064.cif@120115

test_ase_primitive_and_conventional_cells_pymatgen()[source]

Checking the number of atoms per primitive/conventional cell returned by ASE ase.io.read() method. Test input is adapted from http://www.crystallography.net/cod/9012064.cif@120115

test_attached_hydrogens()[source]
test_change_cifdata_file()[source]
test_cif_roundtrip()[source]
test_cif_with_long_line()[source]

Tests CifData - check that long lines (longer than 2048 characters) are supported. Should not raise any error.

test_empty_cif()[source]

Test empty CifData

Note: This test does not need PyCifRW.

test_get_aiida_structure()[source]
test_parse_cifdata()[source]
test_parse_formula()[source]
test_parse_policy()[source]

Test that loading of CIF file occurs as defined by parse_policy.

test_pycifrw_from_datablocks()[source]

Tests CifData.pycifrw_from_cif()

test_pycifrw_syntax()[source]

Tests CifData.pycifrw_from_cif() - check syntax pb in PyCifRW 3.6

test_refine()[source]

Test case for refinement (space group determination) for a CifData object.

test_reload_cifdata()[source]
test_scan_type()[source]

Check that different scan_types of PyCifRW produce the same result.

test_set_file()[source]

Test that setting a new file clears formulae and spacegroups.

test_symop_string_from_symop_matrix_tr()[source]
valid_sample_cif_str = "\n data_test\n _cell_length_a 10\n _cell_length_b 10\n _cell_length_c 10\n _cell_angle_alpha 90\n _cell_angle_beta 90\n _cell_angle_gamma 90\n _chemical_formula_sum 'C O2'\n loop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n _atom_site_attached_hydrogens\n C 0 0 0 0\n O 0.5 0.5 0.5 .\n H 0.75 0.75 0.75 0\n "
valid_sample_cif_str_2 = "\n data_test\n _cell_length_a 10\n _cell_length_b 10\n _cell_length_c 10\n _cell_angle_alpha 90\n _cell_angle_beta 90\n _cell_angle_gamma 90\n _chemical_formula_sum 'C O'\n loop_\n _atom_site_label\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n _atom_site_attached_hydrogens\n C 0 0 0 0\n O 0.5 0.5 0.5 .\n "
class aiida.backends.tests.dataclasses.TestKindTestGeneral(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of Kind objects and their methods.

__module__ = 'aiida.backends.tests.dataclasses'
test_automatic_name()[source]

Check the automatic name generator.

test_no_position()[source]

Should not accept a ‘positions’ parameter

test_simple()[source]

Should recognize a simple element.

test_sum_less_one_general()[source]

Should accept a sum equal less than one

test_sum_one_general()[source]

Should accept a sum equal to one

class aiida.backends.tests.dataclasses.TestKindTestMasses(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the management of masses during the creation of Kind objects.

__module__ = 'aiida.backends.tests.dataclasses'
test_auto_mass_one()[source]

mass for elements with sum one

test_manual_mass()[source]

mass set manually

test_sum_less_one_masses()[source]

mass for elements with sum less than one

test_sum_less_one_singleelem()[source]

mass for a single element

class aiida.backends.tests.dataclasses.TestKindValidSymbols(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the symbol validation of the aiida.orm.data.structure.Kind class.

__module__ = 'aiida.backends.tests.dataclasses'
test_bad_symbol()[source]

Should not accept a non-existing symbol.

test_empty_list_symbols()[source]

Should not accept an empty list

test_valid_list()[source]

Should not raise any error.

class aiida.backends.tests.dataclasses.TestKpointsData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the TrajectoryData objects.

__module__ = 'aiida.backends.tests.dataclasses'
test_kpoints_to_cartesian()[source]

Test how the list of kpoints is converted to cartesian coordinates

test_list()[source]

Test the method to set and retrieve a kpoint list.

test_mesh()[source]

Check the methods to set and retrieve a mesh.

test_path()[source]

Test the methods to generate automatically a list of kpoints

test_path_wrapper_legacy()[source]

This is a clone of the test_path test but instead it goes through the new wrapper calling the deprecated legacy implementation. This tests that the wrapper maintains the same behavior of the old implementation

test_set_kpoints_path_legacy()[source]

Regression test for the deprecated KpointsData.set_kpoints_path method. For certain formats of a direct kpoint list, it is not necessary to have defined a cell.

test_tetra_x()[source]

testing tetragonal cells with axis along X

test_tetra_z()[source]

testing tetragonal cells with axis along X

test_tetra_z_wrapper_legacy()[source]

This is a clone of the test_tetra_z test but instead it goes through the new wrapper calling the deprecated legacy implementation. This tests that the wrapper maintains the same behavior of the old implementation

class aiida.backends.tests.dataclasses.TestPymatgenFromStructureData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of pymatgen Structure and Molecule objects from StructureData.

class StrictVersion(vstring=None)

Bases: distutils.version.Version

Version numbering for anal retentives and software idealists. Implements the standard interface for version number classes as described above. A version number consists of two or three dot-separated numeric components, with an optional “pre-release” tag on the end. The pre-release tag consists of the letter ‘a’ or ‘b’ followed by a number. If the numeric components of two version numbers are equal, then one with a pre-release tag will always be deemed earlier (lesser) than one without.

The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):

0.4 0.4.0 (these two are equivalent) 0.4.1 0.5a1 0.5b3 0.5 0.9.6 1.0 1.0.4a3 1.0.4b1 1.0.4

The following are examples of invalid version numbers:

1 2.7.2.2 1.3.a4 1.3pl1 1.3c4

The rationale for this version numbering system will be explained in the distutils documentation.

__cmp__(other)
__module__ = 'distutils.version'
__str__()
parse(vstring)
version_re = <_sre.SRE_Pattern object>
__module__ = 'aiida.backends.tests.dataclasses'
get_pymatgen_version()
Returns:string with pymatgen version, None if can not import.
has_ase()
Returns:True if the ase module can be imported, False otherwise.
has_pymatgen()
Returns:True if the pymatgen module can be imported, False otherwise.
test_1()[source]

Tests the check of periodic boundary conditions.

test_2()[source]

Tests ASE -> StructureData -> pymatgen

test_3()[source]

Tests the conversion of StructureData to pymatgen’s Molecule (ASE -> StructureData -> pymatgen)

test_partial_occ_and_spin()[source]

Tests StructureData -> pymatgen, with partial occupancies and spins. This should raise a ValueError.

test_roundtrip()[source]

Tests roundtrip StructureData -> pymatgen -> StructureData (no spins)

test_roundtrip_kindnames()[source]

Tests roundtrip StructureData -> pymatgen -> StructureData (no spins, but with all kind of kind names)

test_roundtrip_partial_occ()[source]

Tests roundtrip StructureData -> pymatgen -> StructureData (with partial occupancies).

test_roundtrip_spins()[source]

Tests roundtrip StructureData -> pymatgen -> StructureData (with spins)

class aiida.backends.tests.dataclasses.TestSeekpathExplicitPath(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.dataclasses'
test_simple()[source]
class aiida.backends.tests.dataclasses.TestSeekpathPath(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.dataclasses'
test_simple()[source]
class aiida.backends.tests.dataclasses.TestSinglefileData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the SinglefileData class.

__module__ = 'aiida.backends.tests.dataclasses'
test_reload_singlefiledata()[source]
class aiida.backends.tests.dataclasses.TestSiteValidWeights(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests valid weight lists.

__module__ = 'aiida.backends.tests.dataclasses'
test_empty_list_weights()[source]

Should not accept an empty list

test_isnot_list()[source]

Should not accept a non-list, non-number weight

test_negative_value()[source]

Should not accept a negative weight

test_none()[source]

Should accept None.

test_sum_greater_one()[source]

Should not accept a sum of weights larger than one

test_sum_less_one_weights()[source]

Should accept a sum equal less than one

test_sum_one_weights()[source]

Should accept a sum equal to one

test_symbol_weight_mismatch()[source]

Should not accept a size mismatch of the symbols and weights list.

class aiida.backends.tests.dataclasses.TestSpglibTupleConversion(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.dataclasses'
test_aiida_roundtrip()[source]

Convert an AiiDA structure to a tuple and go back to see if we get the same results

test_complex1_to_aiida()[source]

Test conversion of a tuple to an AiiDA structure when passing also information on the kinds

test_from_aiida()[source]

Test conversion of an AiiDA structure to a spglib tuple

test_simple_to_aiida()[source]

Test conversion of a simple tuple to an AiiDA structure

class aiida.backends.tests.dataclasses.TestStructureData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of StructureData objects (cell and pbc).

__module__ = 'aiida.backends.tests.dataclasses'
has_ase()
Returns:True if the ase module can be imported, False otherwise.
has_pycifrw()
Returns:True if the PyCifRW module can be imported, False otherwise.
has_spglib()
Returns:True if the spglib module can be imported, False otherwise.
test_cell_ok_and_atoms()[source]

Test the creation of a cell and the appending of atoms

test_get_cif()[source]

Tests the conversion to CifData

test_get_formula()[source]

Tests the generation of formula

test_kind_1()[source]

Test the management of kinds (automatic detection of kind of simple atoms).

test_kind_2()[source]

Test the management of kinds (manual specification of kind name).

test_kind_3()[source]

Test the management of kinds (adding an atom with different mass).

test_kind_4()[source]

Test the management of kind (adding an atom with different symbols or weights).

test_kind_5()[source]

Test the management of kinds (automatic creation of new kind if name is not specified and properties are different).

test_kind_5_bis()[source]

Test the management of kinds (automatic creation of new kind if name is not specified and properties are different). This test was failing in, e.g., commit f6a8f4b.

test_kind_5_bis_ase()[source]

Same test as test_kind_5_bis, but using ase

test_kind_6()[source]

Test the returning of kinds from the string name (most of the code copied from test_kind_5()).

test_kind_7()[source]

Test the functions returning the list of kinds, symbols, …

test_kind_8()[source]

Test the ase_refine_cell() function

test_xyz_parser()[source]
class aiida.backends.tests.dataclasses.TestStructureDataFromAse(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of Sites from/to a ASE object.

__module__ = 'aiida.backends.tests.dataclasses'
has_ase()
Returns:True if the ase module can be imported, False otherwise.
test_ase()[source]

Tests roundtrip ASE -> StructureData -> ASE

test_conversion_of_types_1()[source]

Tests roundtrip ASE -> StructureData -> ASE, with tags

test_conversion_of_types_2()[source]

Tests roundtrip ASE -> StructureData -> ASE, with tags, and changing the atomic masses

test_conversion_of_types_3()[source]

Tests StructureData -> ASE, with all sorts of kind names

test_conversion_of_types_4()[source]

Tests ASE -> StructureData -> ASE, in particular conversion tags / kind names

test_conversion_of_types_5()[source]

Tests ASE -> StructureData -> ASE, in particular conversion tags / kind names (subtle variation of test_conversion_of_types_4)

test_conversion_of_types_6()[source]

Tests roundtrip StructureData -> ASE -> StructureData, with tags/kind names

class aiida.backends.tests.dataclasses.TestStructureDataFromPymatgen(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of StructureData from a pymatgen Structure and Molecule objects.

class StrictVersion(vstring=None)

Bases: distutils.version.Version

Version numbering for anal retentives and software idealists. Implements the standard interface for version number classes as described above. A version number consists of two or three dot-separated numeric components, with an optional “pre-release” tag on the end. The pre-release tag consists of the letter ‘a’ or ‘b’ followed by a number. If the numeric components of two version numbers are equal, then one with a pre-release tag will always be deemed earlier (lesser) than one without.

The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):

0.4 0.4.0 (these two are equivalent) 0.4.1 0.5a1 0.5b3 0.5 0.9.6 1.0 1.0.4a3 1.0.4b1 1.0.4

The following are examples of invalid version numbers:

1 2.7.2.2 1.3.a4 1.3pl1 1.3c4

The rationale for this version numbering system will be explained in the distutils documentation.

__cmp__(other)
__module__ = 'distutils.version'
__str__()
parse(vstring)
version_re = <_sre.SRE_Pattern object>
__module__ = 'aiida.backends.tests.dataclasses'
get_pymatgen_version()
Returns:string with pymatgen version, None if can not import.
has_pymatgen()
Returns:True if the pymatgen module can be imported, False otherwise.
test_1()[source]

Tests roundtrip pymatgen -> StructureData -> pymatgen Test’s input is derived from COD entry 9011963, processed with cif_mark_disorder (from cod-tools) and abbreviated.

test_2()[source]

Tests xyz -> pymatgen -> StructureData Input source: http://pymatgen.org/_static/Molecule.html

test_multiple_kinds_alloy()[source]

Tests that a structure with multiple sites with the same alloy symbols but different weights, get their own unique kind name

test_multiple_kinds_partial_occupancies()[source]

Tests that a structure with multiple sites with the same element but different partial occupancies, get their own unique kind name

test_partial_occ_and_spin()[source]

Tests pymatgen -> StructureData, with partial occupancies and spins. This should raise a ValueError.

class aiida.backends.tests.dataclasses.TestStructureDataInit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of StructureData objects (cell and pbc).

__module__ = 'aiida.backends.tests.dataclasses'
test_cell_ok_init()[source]

Correct cell

test_cell_wrong_size_1()[source]

Wrong cell size (not 3x3)

test_cell_wrong_size_2()[source]

Wrong cell size (not 3x3)

test_cell_zero_vector()[source]

Wrong cell (one vector has zero length)

test_cell_zero_volume()[source]

Wrong cell (volume is zero)

test_ok_pbc_1()[source]

Single pbc value

test_ok_pbc_2()[source]

One-element list

test_ok_pbc_3()[source]

Three-element list

test_volume()[source]

Check the volume calculation

test_wrong_pbc_1()[source]

Wrong pbc parameter (not bool or iterable)

test_wrong_pbc_2()[source]

Wrong pbc parameter (iterable but with wrong len)

test_wrong_pbc_3()[source]

Wrong pbc parameter (iterable but with wrong len)

class aiida.backends.tests.dataclasses.TestStructureDataLock(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests that the structure is locked after storage

__module__ = 'aiida.backends.tests.dataclasses'
test_lock()[source]

Start from a StructureData object, convert to raw and then back

class aiida.backends.tests.dataclasses.TestStructureDataReload(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of StructureData, converting it to a raw format and converting it back.

__module__ = 'aiida.backends.tests.dataclasses'
test_copy()[source]

Start from a StructureData object, copy it and see if it is preserved

test_reload()[source]

Start from a StructureData object, convert to raw and then back

class aiida.backends.tests.dataclasses.TestTrajectoryData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the TrajectoryData objects.

__module__ = 'aiida.backends.tests.dataclasses'
test_conversion_from_structurelist()[source]

Check the method to create a TrajectoryData from list of AiiDA structures.

test_conversion_to_structure()[source]

Check the methods to export a given time step to a StructureData node.

test_creation()[source]

Check the methods to set and retrieve a trajectory.

test_export_to_file()[source]

Export the band structure on a file, check if it is working

aiida.backends.tests.dataclasses.has_seekpath()[source]

Check if there is the seekpath dependency

Returns:True if seekpath is installed, False otherwise
aiida.backends.tests.dataclasses.simplify(string)[source]

Takes a string, strips spaces in each line and returns it Useful to compare strings when different versions of a code give different spaces.

aiida.backends.tests.dataclasses.to_list_of_lists(lofl)[source]

Converts an iterable of iterables to a list of lists, needed for some tests (e.g. when one has a tuple of lists, a list of tuples, …)

Parameters:lofl – an iterable of iterables
Returns:a list of lists

Tests for subclasses of DbImporter, DbSearchResults and DbEntry

class aiida.backends.tests.dbimporters.TestCodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the CodDbImporter class.

__module__ = 'aiida.backends.tests.dbimporters'
has_pycifrw()
Returns:True if the PyCifRW module can be imported, False otherwise.
test_datatype_checks()[source]

Rather complicated, but wide-coverage test for data types, accepted and rejected by CodDbImporter._*_clause methods.

test_dbentry_creation()[source]

Tests the creation of CodEntry from CodSearchResults.

test_dbentry_to_cif_node()[source]

Tests the creation of CifData node from CodEntry.

test_query_construction_1()[source]
class aiida.backends.tests.dbimporters.TestMpodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the MpodDbImporter class.

__module__ = 'aiida.backends.tests.dbimporters'
test_dbentry_creation()[source]

Tests the creation of MpodEntry from MpodSearchResults.

class aiida.backends.tests.dbimporters.TestNnincDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the UpfEntry class.

__module__ = 'aiida.backends.tests.dbimporters'
test_upfentry_creation()[source]

Tests the creation of NnincEntry from NnincSearchResults.

class aiida.backends.tests.dbimporters.TestPcodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the PcodDbImporter class.

__module__ = 'aiida.backends.tests.dbimporters'
test_dbentry_creation()[source]

Tests the creation of PcodEntry from PcodSearchResults.

class aiida.backends.tests.dbimporters.TestTcodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the TcodDbImporter class.

__module__ = 'aiida.backends.tests.dbimporters'
test_dbentry_creation()[source]

Tests the creation of TcodEntry from TcodSearchResults.

class aiida.backends.tests.example_helpers.TestExampleHelpers(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

CODE_LABEL = 'test_code'
INPUT_PLUGIN_NAME = 'test_input_plugin'
__module__ = 'aiida.backends.tests.example_helpers'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_test_and_get_code()[source]

Checks that the test_and_get_code functions of the example_helpers file behaves as expected.

Tests for the export and import routines.

class aiida.backends.tests.export_and_import.TestComplex(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.export_and_import'
test_complex_graph_import_export()[source]

This test checks that a small and bit complex graph can be correctly exported and imported.

It will create the graph, store it to the database, export it to a file and import it. In the end it will check if the initial nodes are present at the imported graph.

class aiida.backends.tests.export_and_import.TestComputer(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.export_and_import'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_correct_import_of_computer_json_params()[source]

This test checks that the metadata and transport params are exported and imported correctly in both backends.

test_different_computer_same_name_import()[source]

This test checks that if there is a name collision, the imported computers are renamed accordingly.

test_import_of_django_sqla_export_file()[source]

Check why sqla import manages to import the django export file correctly

test_same_computer_different_name_import()[source]

This test checks that if the computer is re-imported with a different name to the same database, then the original computer will not be renamed. It also checks that the names were correctly imported (without any change since there is no computer name collision)

test_same_computer_import()[source]

Test that you can import nodes in steps without any problems. In this test we will import a first calculation and then a second one. The import should work as expected and have in the end two job calculations.

Each calculation is related to the same computer. In the end we should have only one computer

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.export_and_import'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

Simple test that will verify that INPUT and CREATE links are properly exported and correctly recreated upon import.

Check that CALL links are not followed in the export procedure with dangling links as a consequence:

    ---------->---------
 __|_       ___        _|_
|    | INP |   | CALL |   |
| i1 | --> | C | <--  | W |
|____|     |___|      |___|
             |
             v  CREATE
            ____ 
           |    |
           | o1 |
           |____|

Check that CALL links are not followed in the export procedure, and the only creation is followed for data:

 ____       ____        ____
|    | INP |    | CALL |    |
| i1 | --> | w1 | <--- | w2 |
|____|     |____|      |____|
            | |
     CREATE v v RETURN
            ____
           |    |
           | o1 |
           |____|
class aiida.backends.tests.export_and_import.TestSimple(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.export_and_import'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_0()[source]
test_1()[source]
test_2()[source]

Test the check for the export format version.

test_3()[source]

Test importing of nodes, that have links to unknown nodes.

test_4()[source]

Test control of licenses.

test_5()[source]

This test checks that nodes belonging to different users are correctly exported & imported.

test_6()[source]

This test checks that nodes belonging to user A (which is not the default user) can be correctly exported, imported, enriched with nodes from the default user, re-exported & re-imported and that in the end all the nodes that have been finally imported belonging to the right users.

test_7()[source]

This test checks that nodes that belong to a specific group are correctly imported and exported.

test_reexport()[source]

Export something, import and reexport and check if everything is valid. The export is rather easy:

 ___       ___          ___
|   | INP |   | CREATE |   |
| p | --> | c | -----> | a |
|___|     |___|        |___|
test_workcalculation_2()[source]
test_workfunction_1()[source]
class aiida.backends.tests.export_and_import.TestSpecificImport(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.export_and_import'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_cycle_structure_data()[source]

Create an export with some Calculation and Data nodes and import it after having cleaned the database. Verify that the nodes and their attributes are restored properly after importing the created export archive

test_simple_import()[source]

This is a very simple test which checks that an export file with nodes that are not associated to a computer is imported correctly. In Django when such nodes are exported, there is an empty set for computers in the export file. In SQLA there is such a set only when a computer is associated with the exported nodes. When an empty computer set is found at the export file (when imported to an SQLA profile), the SQLA import code used to crash. This test demonstrates this problem.

Generic tests that need the use of the DB

class aiida.backends.tests.generic.TestBool(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.generic'
test_bool_conversion()[source]
test_int_conversion()[source]
class aiida.backends.tests.generic.TestCode(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the Code class.

__module__ = 'aiida.backends.tests.generic'
test_code_local()[source]
test_remote()[source]
class aiida.backends.tests.generic.TestDbExtras(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test Extras

__module__ = 'aiida.backends.tests.generic'
test_replacement()[source]
class aiida.backends.tests.generic.TestGroups(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test groups.

__module__ = 'aiida.backends.tests.generic'
test_add_nodes()[source]

Test different ways of adding nodes

test_creation()[source]
test_creation_from_dbgroup()[source]
test_delete()[source]
test_description()[source]

Test the update of the description both for stored and unstored groups.

test_name_desc()[source]
test_remove_nodes()[source]

Test node removal

class aiida.backends.tests.generic.TestWfBasic(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for the workflows

__module__ = 'aiida.backends.tests.generic'
test_versioning_lowlevel()[source]

Checks the versioning.

Tests for inline calculations.

class aiida.backends.tests.inline_calculation.TestInlineCalculation(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for the InlineCalculation calculations.

__module__ = 'aiida.backends.tests.inline_calculation'
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_caching()[source]
test_caching_change_code()[source]
test_incr()[source]

Simple test for the inline increment function.

class aiida.backends.tests.nodes.AnyValue[source]

Bases: object

Helper class that compares equal to everything.

__dict__ = dict_proxy({'__dict__': <attribute '__dict__' of 'AnyValue' objects>, '__weakref__': <attribute '__weakref__' of 'AnyValue' objects>, '__module__': 'aiida.backends.tests.nodes', '__eq__': <function __eq__>, '__doc__': '\n Helper class that compares equal to everything.\n '})
__eq__(other)[source]

x.__eq__(y) <==> x==y

__module__ = 'aiida.backends.tests.nodes'
__weakref__

list of weak references to the object (if defined)

class aiida.backends.tests.nodes.TestDataNode(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

These tests check the features of Data nodes that differ from the base Node

__module__ = 'aiida.backends.tests.nodes'
boolval = True
dictval = {'emptydict': {}, 'num': 3, 'recursive': {'a': 1, 'c': 1.2, 'b': True, 'e': {'yy': [], 'x': None, 'xx': {}, 'z': 'z'}, 'd': [1, 2, None]}, 'something': 'else'}
emptydict = {}
emptylist = []
floatval = 4.56
intval = 123
listval = [1, 's', True, None]
stringval = 'aaaa'
test_attr_after_storing()[source]
test_modify_attr_after_store()[source]
class aiida.backends.tests.nodes.TestNodeBasic(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

These tests check the basic features of nodes (setting of attributes, copying of files, …)

DISABLED()[source]

This test routine is disabled for the time being; I will re-enable when I have time to implement the check of the length of the ‘key’.

__module__ = 'aiida.backends.tests.nodes'
boolval = True
dictval = {'emptydict': {}, 'num': 3, 'recursive': {'a': 1, 'c': 1.2, 'b': True, 'e': {'yy': [], 'x': None, 'xx': {}, 'z': 'z'}, 'd': [1, 2, None]}, 'something': 'else'}
emptydict = {}
emptylist = []
floatval = 4.56
intval = 123
listval = [1, 's', True, None]
stringval = 'aaaa'
test_append_no_side_effects()[source]

Check that _append_to_attr has no side effects

test_append_to_empty_attr()[source]

Appending to an empty attribute

test_attr_after_storing()[source]
test_attr_and_extras()[source]
test_attr_and_extras_multikey()[source]

Multiple nodes with the same key. This should not be a problem

I test only extras because the two tables are formally identical

test_attr_before_storing()[source]
test_attr_listing()[source]

Checks that the list of attributes and extras is ok.

test_attr_with_reload()[source]
test_attribute_mutability()[source]

Attributes of a node should be immutable after storing, unless the stored_check is disabled in the call

test_attributes_on_copy()[source]
test_basetype_as_attr()[source]

Test that setting a basetype as an attribute works transparently

test_basetype_as_extra()[source]

Test that setting a basetype as an attribute works transparently

test_code_description()[source]

This test checks that the code description is retrieved correctly when the code is searched with its id and label.

test_code_loading_from_string()[source]

Checks that the method Code.get_from_string works correctly.

test_code_loading_using_get()[source]

Checks that the method Code.get(pk) works correctly.

test_comments()[source]
test_datetime_attribute()[source]
test_delete_extras()[source]

Checks the ability of deleting extras, also when they are dictionaries or lists.

test_files()[source]
test_folders()[source]

Similar as test_files, but I manipulate a tree of folders

test_get_attrs_after_storing()[source]
test_get_attrs_before_storing()[source]
test_get_extras_with_default()[source]
test_get_subclass_from_pk()[source]

This test checks that aiida.orm.implementation.general.node.AbstractNode#get_subclass_from_pk works correctly for both backends.

test_list_for_plugin()[source]

This test checks the Code.list_for_plugin()

test_load_node()[source]

Tests the load node functionality

test_load_unknown_calculation_type()[source]

Test that the loader will choose a common calculation ancestor for an unknown data type. For the case where, e.g., the user doesn’t have the necessary plugin.

test_load_unknown_data_type()[source]

Test that the loader will choose a common data ancestor for an unknown data type. For the case where, e.g., the user doesn’t have the necessary plugin.

test_replace_extras_1()[source]

Checks the ability of replacing extras, removing the subkeys also when these are dictionaries or lists.

test_settings_methods()[source]
test_store_object()[source]

Trying to store objects should fail

test_versioning()[source]

Test the versioning of the node when setting attributes and extras

test_versioning_lowlevel()[source]

Checks the versioning.

class aiida.backends.tests.nodes.TestNodeDeletion(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.nodes'
_check_existence(uuids_check_existence, uuids_check_deleted)[source]

I get 2 lists of uuids

Parameters:
  • uuids_check_existence (list) – The list of uuids that have to exist
  • uuids_check_deleted (list) – The list of uuids that should not exist, I check that NotExistent is raised.
_create_calls_n_returns_graph()[source]

Creates a complicated graph with a master with 1 inputs, 2 slaves of it also using that input and an additional 1, producing output that is either returned or not returned by the master. Master also creates one nodes. This allows to check whether the delete_nodes command works as anticipated.

test_delete_called_but_not_caller()[source]

Check that deleting a Calculation that was called by another Calculation which won’t be deleted works, even though it will raise a warning

test_deletion_no_calls_no_returns()[source]

Checking the case where I don’t follow calls and also not return links for deletion

test_deletion_no_calls_with_returns()[source]

Checking the case where I follow returns and not calls for deletion

test_deletion_simple()[source]

I’m setting up a sequence of nodes connected by data provenance links. Testing whether I will delete the right ones.

test_deletion_with_calls_no_returns()[source]

Checking the case where I follow calls and not return links for deletion

test_deletion_with_calls_with_returns()[source]

Checking the case where I follow calls and return links for deletion

test_deletion_with_returns_n_loops()[source]

Setting up a simple loop, to check that the following doesn’t go bananas.

class aiida.backends.tests.nodes.TestNodeHashing(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the functionality of hashing a node

__module__ = 'aiida.backends.tests.nodes'
static create_folderdata_with_empty_file()[source]
static create_folderdata_with_empty_folder()[source]
static create_simple_node(b=0, c=0)[source]
test_file_same()[source]
test_folder_file_different()[source]
test_folder_same()[source]
test_simple_equal_nodes()[source]
test_simple_unequal_nodes()[source]
test_unequal_arrays()[source]
test_updatable_attributes()[source]

Tests that updatable attributes are ignored.

class aiida.backends.tests.nodes.TestQueryWithAiidaObjects(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test if queries work properly also with aiida.orm.Node classes instead of aiida.backends.djsite.db.models.DbNode objects.

__module__ = 'aiida.backends.tests.nodes'
test_get_inputs_and_outputs()[source]
test_with_subclasses()[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.nodes'

Test the proper functionality of the links cache, with different scenarios.

test_calculation_load()[source]
test_check_single_calc_source()[source]

Each data node can only have one input calculation

test_has_children_has_parents()[source]

This check verifies that the properties has_children has_parents of the Node class behave correctly.

It is possible to store links between nodes even if they are unstored; these links are cached. However, if working in the cache, an explicit link name must be provided.

Test that the link_type parameter in get_inputs only returns those nodes with the correct link type for unstored nodes. We don’t check this analogously for get_outputs because there is not output links cache

Test that the link_type parameter in get_inputs and get_outputs only returns those nodes with the correct link type for stored nodes

test_store_with_unstored_parents()[source]

I want to check that if parents are unstored I cannot store

test_storeall_with_unstored_grandparents()[source]

I want to check that if grandparents are unstored I cannot store_all

test_use_code()[source]
class aiida.backends.tests.nodes.TestTransitiveNoLoops(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the transitive closure functionality

__module__ = 'aiida.backends.tests.nodes'
test_loop_not_allowed()[source]

Tests for specific subclasses of Data

exception aiida.backends.tests.parsers.SkipTestException[source]

Bases: exceptions.Exception

__module__ = 'aiida.backends.tests.parsers'
__weakref__

list of weak references to the object (if defined)

class aiida.backends.tests.parsers.TestParsers(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

This class dynamically finds all tests in a given subfolder, and loads them as different tests.

class __metaclass__[source]

Bases: type

Some python black magic to dynamically create tests

__module__ = 'aiida.backends.tests.parsers'
static __new__(name, bases, attrs)[source]
__module__ = 'aiida.backends.tests.parsers'
longMessage = True
read_test(outfolder)[source]
classmethod return_base_test(folder)[source]
aiida.backends.tests.parsers._comparison_AlmostEqual(testclass, dbdata, comparisondata)[source]

Compare two numbers (or a list of numbers) to check that they are all almost equal (within a default precision of 7 digits)

aiida.backends.tests.parsers._comparison_Equal(testclass, dbdata, comparisondata)[source]

Compare two objects to see if they are equal

aiida.backends.tests.parsers._comparison_LengthEqual(testclass, dbdata, comparisondata)[source]

Check if the length of the object is equal to the value specified

aiida.backends.tests.parsers.is_valid_folder_name(name)[source]

Return True if the string (that will be the folder name of each subtest) is a valid name for a test function: it should start with test_, and contain only letters, digits or underscores.

aiida.backends.tests.parsers.output_test(pk, testname, skip_uuids_from_inputs=[])[source]

This is the function that should be used to create a new test from an existing calculation.

It is possible to simplify the file removing unwanted nodes.

Parameters:
  • pk – PK of Calculation, used for test
  • testname – the name of this test, used to create a new folder. The folder name will be of the form test_PLUGIN_TESTNAME, with PLUGIN substituted by the plugin name, with dots replaced by underscores. Testname can contain only digits, letters and underscores.
  • skip_uuids_from_inputs – a list of UUIDs of input nodes to be skipped
class aiida.backends.tests.query.QueryBuilderDateTimeAttribute(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_date()[source]
class aiida.backends.tests.query.QueryBuilderJoinsTests(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_joins1()[source]
test_joins2()[source]
test_joins3_user_group()[source]
class aiida.backends.tests.query.QueryBuilderLimitOffsetsTest(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_ordering_limits_offsets_of_results_general()[source]
class aiida.backends.tests.query.QueryBuilderPath(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_query_path()[source]
class aiida.backends.tests.query.TestAttributes(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_attribute_existence()[source]
class aiida.backends.tests.query.TestConsistency(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_create_node_and_query()[source]
class aiida.backends.tests.query.TestManager(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_statistics()[source]

Test if the statistics query works properly.

I try to implement it in a way that does not depend on the past state.

test_statistics_default_class()[source]

Test if the statistics query works properly.

I try to implement it in a way that does not depend on the past state.

class aiida.backends.tests.query.TestQueryBuilder(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.query'
test_append_validation()[source]
test_classification()[source]

This tests the classifications of the QueryBuilder

test_list_behavior()[source]
test_operators_eq_lt_gt()[source]
test_simple_query_1()[source]

Testing a simple query

test_simple_query_2()[source]
test_subclassing()[source]
test_tags()[source]
class aiida.backends.tests.query.TestQueryBuilderCornerCases(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

In this class corner cases of QueryBuilder are added.

__module__ = 'aiida.backends.tests.query'
test_computer_json()[source]

In this test we check the correct behavior of QueryBuilder when retrieving the _metadata and the transport_params with no content. Note that they are in JSON format in both backends. Forcing the decoding of a None value leads to an exception (this was the case under Django).

class aiida.backends.tests.restapi.RESTApiTestCase(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Setup of the tests for the AiiDA RESTful-api

_LIMIT_DEFAULT = 400
_PERPAGE_DEFAULT = 20
__module__ = 'aiida.backends.tests.restapi'
_dummy_data = {}
_url_prefix = '/api/v2'
compare_extra_response_data(node_type, url, response, uuid=None)[source]

In url response, we pass some extra information/data along with the node results. e.g. url method, node_type, path, pk, query_string, url, url_root, etc.

Parameters:
  • node_type – url requested fot the type of the node
  • url – web url
  • response – url response
  • uuid – url requested for the node pk
get_dummy_data()[source]
get_url_prefix()[source]
node_exception(url, exception_type)[source]

Assert exception if any unknown parameter is passed in url :param url: web url :param exception_type: exception to be thrown :return:

classmethod process_dummy_data()[source]

This functions prepare atomic chunks of typical responses from the RESTapi and puts them into class attributes

process_test(node_type, url, full_list=False, empty_list=False, expected_list_ids=[], expected_range=[], expected_errormsg=None, uuid=None, result_node_type=None, result_name=None)[source]

Check whether response matches expected values.

Parameters:
  • node_type – url requested fot the type of the node
  • url – web url
  • full_list – if url is requested to get full list
  • empty_list – if the response list is empty
  • expected_list_ids – list of expected ids from data
  • expected_range – [start, stop] range of expected ids from data
  • expected_errormsg – expected error message in response
  • uuid – url requested for the node pk
  • result_node_type – node type in response data
  • result_name – result name in response e.g. inputs, outputs
classmethod setUpClass()[source]

Basides the standard setup we need to add few more objects in the database to be able to explore different requests/filters/orderings etc.

split_path(url)[source]

Split the url with “?” to get url path and it’s parameters :param url: Web url :return: url path and url parameters

class aiida.backends.tests.restapi.RESTApiTestSuite(methodName='runTest')[source]

Bases: aiida.backends.tests.restapi.RESTApiTestCase

__module__ = 'aiida.backends.tests.restapi'
test_calculation_attributes()[source]

Get list of calculation attributes

test_calculation_attributes_alist_filter()[source]

Get list of calculation attributes with filter alist

test_calculation_attributes_nalist_filter()[source]

Get list of calculation attributes with filter nalist

test_calculation_input_filters()[source]

Get filtered inputs list for given calculations

test_calculation_inputs()[source]

Get the list of give calculation inputs

test_calculations_details()[source]

Requests the details of single calculation

test_calculations_list()[source]

Get the full list of calculations from database

test_calculations_list_limit_offset()[source]

Get the list of calculations from database using limit and offset parameter. It should return the no of rows specified in limit from database starting from the no. specified in offset

test_cif()[source]

Test download of cif file

test_computers_details()[source]

Requests the details of single computer

test_computers_filter_hostname()[source]

Add filter for the hostname of computer and get the filtered computer list

test_computers_filter_id1()[source]

Add filter on the id of computer and get the filtered computer list (e.g. id=1)

test_computers_filter_id2()[source]

Add filter on the id of computer and get the filtered computer list (e.g. id > 2)

test_computers_filter_mixed1()[source]

Add filter for the hostname and id of computer and get the filtered computer list

test_computers_filter_mixed2()[source]

Add filter for the id, hostname and transport_type of the computer and get the filtered computer list

test_computers_filter_name()[source]

Add filter for the name of computer and get the filtered computer list

test_computers_filter_pk()[source]

Add filter on the id of computer and get the filtered computer list (e.g. id=1)

test_computers_filter_transport_type()[source]

Add filter for the transport_type of computer and get the filtered computer list

test_computers_list()[source]

Get the full list of computers from database

test_computers_list_limit_offset()[source]

Get the list of computers from database using limit and offset parameter. It should return the no of rows specified in limit from database starting from the no. specified in offset

test_computers_list_limit_offset_perpage()[source]

If we pass the limit, offset and perpage at same time, it would return the error message.

test_computers_list_limit_only()[source]

Get the list of computers from database using limit parameter. It should return the no of rows specified in limit from database.

test_computers_list_offset_only()[source]

Get the list of computers from database using offset parameter It should return all the rows from database starting from the no. specified in offset

test_computers_list_page_default()[source]

it returns the no. of rows defined as default perpage option from database.

no.of pages = total no. of computers in database / perpage “/page” acts as “/page/1?perpage=default_value”

test_computers_list_page_limit_offset()[source]

If we use the page, limit and offset at same time, it would return the error message.

test_computers_list_page_limit_offset_perpage()[source]

If we use the page, limit, offset and perpage at same time, it would return the error message.

test_computers_list_page_perpage()[source]

no.of pages = total no. of computers in database / perpage Using this formula it returns the no. of rows for requested page

test_computers_list_page_perpage_exceed()[source]

no.of pages = total no. of computers in database / perpage

If we request the page which exceeds the total no. of pages then it would return the error message.

test_computers_mixed1()[source]

url parameters: id, limit and offset

test_computers_mixed2()[source]

url parameters: id, page, perpage

test_computers_mixed3()[source]

url parameters: id, transport_type, orderby

test_computers_orderby_id_asc()[source]

Returns the computers list ordered by “id” in ascending order

test_computers_orderby_id_asc_sign()[source]

Returns the computers list ordered by “+id” in ascending order

test_computers_orderby_id_desc()[source]

Returns the computers list ordered by “id” in descending order

test_computers_orderby_mixed1()[source]

Returns the computers list first order by “transport_type” in ascending order and if it is having same transport_type, order it by “id”

test_computers_orderby_mixed2()[source]

Returns the computers list first order by “scheduler_type” in descending order and if it is having same scheduler_type, order it by “name”

test_computers_orderby_mixed3()[source]

Returns the computers list first order by “scheduler_type” in ascending order and if it is having same scheduler_type, order it by “hostname” descending order

Response:: test4 slurm test3 slurm test2 torque test1 pbspro localhost pbspro ========== Expected:: test1 pbspro localhost pbspro test4 slurm test3 slurm test2 torque test1 test4

RESTApiTestCase.process_test(self, “computers”,
“/computers?orderby=+scheduler_type, -hostname”, expected_list_ids=[1,0,4,3,2])
test_computers_orderby_name_asc()[source]

Returns the computers list ordered by “name” in ascending order

test_computers_orderby_name_asc_sign()[source]

Returns the computers list ordered by “+name” in ascending order

test_computers_orderby_name_desc()[source]

Returns the computers list ordered by “name” in descending order

test_computers_orderby_scheduler_type_asc()[source]

Returns the computers list ordered by “scheduler_type” in ascending order

test_computers_orderby_scheduler_type_asc_sign()[source]

Returns the computers list ordered by “+scheduler_type” in ascending order

test_computers_orderby_scheduler_type_desc()[source]

Returns the computers list ordered by “scheduler_type” in descending order

test_computers_unknown_param()[source]

url parameters: id, limit and offset

from aiida.common.exceptions import InputValidationError RESTApiTestCase.node_exception(self, “/computers?aa=bb&id=2”, InputValidationError)

test_schema()[source]

test schema

test_structure_visualization()[source]

Get the list of give calculation inputs

Tests for TestTcodDbExporter

class aiida.backends.tests.tcodexporter.FakeObject(dictionary)[source]

Bases: object

A wrapper for dictionary, which can be used instead of object. Example use case: fake Calculation object calc, having keys inp and out to access also fake NodeInputManager and NodeOutputManager.

__dict__ = dict_proxy({'__module__': 'aiida.backends.tests.tcodexporter', '__getattr__': <function __getattr__>, '__dict__': <attribute '__dict__' of 'FakeObject' objects>, '__weakref__': <attribute '__weakref__' of 'FakeObject' objects>, '__doc__': '\n A wrapper for dictionary, which can be used instead of object.\n Example use case: fake Calculation object ``calc``, having keys\n ``inp`` and ``out`` to access also fake NodeInputManager and\n NodeOutputManager.\n ', '__init__': <function __init__>})
__getattr__(name)[source]
__init__(dictionary)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__module__ = 'aiida.backends.tests.tcodexporter'
__weakref__

list of weak references to the object (if defined)

class aiida.backends.tests.tcodexporter.TestTcodDbExporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for TcodDbExporter class.

__module__ = 'aiida.backends.tests.tcodexporter'
has_ase()
Returns:True if the ase module can be imported, False otherwise.
has_pycifrw()
Returns:True if the PyCifRW module can be imported, False otherwise.
has_spglib()
Returns:True if the spglib module can be imported, False otherwise.
test_cif_structure_roundtrip(**kwargs)[source]
test_cmdline_parameters()[source]

Ensuring that neither extend_with_cmdline_parameters() nor deposition_cmdline_parameters() set default parameters.

test_collect_files()[source]

Testing the collection of files from file tree.

test_contents_encoding_1()[source]

Testing the logic of choosing the encoding and the process of encoding contents.

test_contents_encoding_2()[source]

Testing the logic of choosing the encoding and the process of encoding contents.

test_export_trajectory()[source]
test_inline_export(**kwargs)[source]
test_nwcpymatgen_translation(**kwargs)[source]
test_symmetry_reduction()[source]
aiida.backends.tests.tcodexporter.has_nwchem_plugin()[source]
class aiida.backends.tests.test_caching_config.CacheConfigTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Tests the caching configuration.

__module__ = 'aiida.backends.tests.test_caching_config'
setUp()[source]

Write a temporary config file, and load the configuration.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_caching_enabled()[source]
test_default()[source]
test_disable_caching()[source]
test_invalid_config()[source]
class aiida.backends.tests.test_plugin_loader.TestExistingPlugins(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test pluginloader’s all_plugins function.

  • will fail when any of the plugins distributed with aiida or installed from external plugin repositories, fails to load
  • will fail if pluginloader returns something else than a list
__module__ = 'aiida.backends.tests.test_plugin_loader'
test_existing_calculations()[source]

Test listing all preinstalled calculations

test_existing_data()[source]

Test listing all preinstalled data classes

test_existing_parsers()[source]

Test listing all preinstalled parsers

test_existing_schedulers()[source]

Test listing all preinstalled schedulers

test_existing_tcod_plugins()[source]

Test listing all preinstalled tcod exporter plugins

test_existing_transports()[source]

Test listing all preinstalled transports

test_existing_workflows()[source]

Test listing all preinstalled workflows

class aiida.backends.tests.verdi_commands.TestVerdiCalculationCommands(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.verdi_commands'
classmethod setUpClass(*args, **kwargs)[source]

Create some calculations with various states

test_calculation_list()[source]

Do some calculation listing to ensure that verdi calculation list works and gives at least to some extent the expected results.

class aiida.backends.tests.verdi_commands.TestVerdiCodeCommands(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.verdi_commands'
classmethod setUpClass(*args, **kwargs)[source]

Create the computers and setup a codes

test_code_list()[source]

Do some code listing test to ensure the correct behaviour of verdi code list

class aiida.backends.tests.verdi_commands.TestVerdiDataCommands(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.verdi_commands'
cmd_to_nodeid_map = {}
cmd_to_nodeid_map_for_groups = {}
cmd_to_nodeid_map_for_nuser = {}
classmethod create_bands_data(cmd_to_nodeid_map, cmd_to_nodeid_map_for_groups, cmd_to_nodeid_map_for_nuser, group, new_user)[source]
classmethod create_cif_data(cmd_to_nodeid_map, cmd_to_nodeid_map_for_groups, cmd_to_nodeid_map_for_nuser, group, new_user)[source]
classmethod create_structure_data(cmd_to_nodeid_map, cmd_to_nodeid_map_for_groups, cmd_to_nodeid_map_for_nuser, group, new_user)[source]
classmethod create_trajectory_data(cmd_to_nodeid_map, cmd_to_nodeid_map_for_groups, cmd_to_nodeid_map_for_nuser, group, new_user)[source]
group_id = None
group_name = 'trj_group'
classmethod setUpClass(*args, **kwargs)[source]

Create some data needed for the tests

classmethod sub_create_bands_data(user=None)[source]
test_trajectory_all_user_listing()[source]
test_trajectory_group_listing()[source]
test_trajectory_past_days_listing()[source]
test_trajectory_simple_listing()[source]
class aiida.backends.tests.verdi_commands.TestVerdiUserCommands(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.verdi_commands'
classmethod setUpClass(*args, **kwargs)[source]

Create a user

test_user_configure()[source]

Try configuring a new user verdi user configure

test_user_list()[source]

verdi user list

class aiida.backends.tests.verdi_commands.TestVerdiWorkCommands(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.verdi_commands'
classmethod setUpClass(*args, **kwargs)[source]

Create a simple workchain and run it.

test_report()[source]

Test that ‘verdi work report’ contains the report message.

test_report_debug()[source]

Test that ‘verdi work report’ contains the report message when called with levelname DEBUG.

test_report_error()[source]

Test that ‘verdi work report’ does not contain the report message when called with levelname ERROR.

class aiida.backends.tests.workflows.TestWorkflowBasic(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

These tests check the basic features of workflows. Now only the load_workflow function is tested.

__module__ = 'aiida.backends.tests.workflows'
tearDown()[source]

Cleaning the database after each test. Since I don’t want the workflows of one test to interfere with the workflows of the other tests.

test_failing_calc_in_wf()[source]

This test checks that a workflow (but also a workflow with sub-workflows) that has an exception at one of its steps stops properly and it is not left as RUNNING.

test_listing_workflows()[source]

Test ensuring that the workflow listing works as expected. (Listing initialized & running workflows and not listing finished workflows or workflows with errors).

test_load_workflows()[source]

Test for load_node() function.

test_result_parameter_name_colision()[source]

This test checks that the the workflow parameters and results do not collide. This was a problem in SQLA (Issue #960) but a test for both backends is added (for completeness).

test_wf_ctime()[source]
test_wf_get_state()[source]

Simple test that checks the state of the workflows. We create two workflows since the test order in the SQLA was influencing the value of aiida.backends.sqlalchemy.models.workflow.DbWorkflow.state which should be a Choice object, according to the SQLA doc. Sometimes it was automatically converted to unicode.

Since we are interested to get a unicode from aiida.orm.implementation.general.workflow.AbstractWorkflow#get_state we enforce this conversion at aiida.orm.implementation.sqlalchemy.workflow.Workflow#get_state

For more info, check issue #951

test_workflow_info()[source]

This test checks that the workflow info is generate without any exceptions :return: