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.test_base_dataclasses.TestFloat(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_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_modulo()[source]
test_mul()[source]
test_power()[source]
class aiida.backends.tests.test_base_dataclasses.TestFloatIntMix(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_base_dataclasses'
test_append()[source]
test_creation()[source]
test_extend()[source]
test_mutability()[source]
test_store_load()[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_contextmanager_disable_global()[source]
test_contextmanager_enable_explicit()[source]
test_default()[source]
test_disable_caching()[source]
test_invalid_config()[source]

Tests for the CalculationNode and CalcJobNode class.

class aiida.backends.tests.test_calculation_node.TestProcessNode(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_calculation_node'
boolval = True
dictval = {'emptydict': {}, 'num': 3, 'recursive': {'boolean': True, 'dictionary': {'empty_dictionary': {}, 'empty_list': [], 'none': None, 'string': 'z'}, 'float': 1.2, 'integer': 1, 'list': [1, 2, None]}, 'something': 'else'}
emptydict = {}
emptylist = []
floatval = 4.56
intval = 123
listval = [1, 's', True, None]
classmethod setUpClass(*args, **kwargs)[source]

Hook method for setting up class fixture before running tests in the class.

stateval = 'RUNNING'
stringval = 'aaaa'
test_get_authinfo()[source]

Test that we can get the AuthInfo object from the calculation instance.

test_get_description()[source]
test_get_transport()[source]

Test that we can get the Transport object from the calculation instance.

test_process_node_updatable_attribute()[source]

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

test_process_state()[source]

Check the properties of a newly created bare CalculationNode

Tests for specific subclasses of Data

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests the ArrayData objects.

__module__ = 'aiida.backends.tests.test_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 get_iterarrays() iterator

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests the BandsData objects.

__module__ = 'aiida.backends.tests.test_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.test_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.test_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_structure()[source]
test_has_partial_occupancies()[source]
test_has_undefined_atomic_sites()[source]
test_has_unknown_species()[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_put_object_from_file()[source]

Test that setting a new file clears formulae and spacegroups.

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_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.test_dataclasses.TestKindTestGeneral(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the creation of Kind objects and their methods.

__module__ = 'aiida.backends.tests.test_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.test_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.test_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.test_dataclasses.TestKindValidSymbols(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

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

Should not accept a non-existing symbol.

test_empty_list_symbols()[source]

Should not accept an empty list

test_unknown_symbol()[source]

Should test if symbol X is valid and defined in the elements dictionary.

test_valid_list()[source]

Should not raise any error.

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests the KpointsData objects.

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestPymatgenFromStructureData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestSeekpathExplicitPath(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the SinglefileData class.

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests valid weight lists.

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestSpglibTupleConversion(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestStructureData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_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_cell_ok_and_unknown_atoms()[source]

Test the creation of a cell and the appending of atoms, including the unknown entry.

test_get_cif()[source]

Tests the conversion to CifData

test_get_formula()[source]

Tests the generation of formula

test_get_formula_unknown()[source]

Tests the generation of formula, including unknown entry.

test_kind_1()[source]

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

test_kind_1_unknown()[source]

Test the management of kinds (automatic detection of kind of simple atoms), inluding the unknown entry.

test_kind_2()[source]

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

test_kind_2_unknown()[source]

Test the management of kinds (manual specification of kind name), including the unknown entry.

test_kind_3()[source]

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

test_kind_3_unknown()[source]

Test the management of kinds (adding an atom with different mass), including the unknown entry.

test_kind_4()[source]

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

test_kind_4_unknown()[source]

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

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_5_bis_ase_unknown()[source]

Same test as test_kind_5_bis_unknown, but using ase

test_kind_5_bis_unknown()[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. This also includes the unknown entry.

test_kind_5_unknown()[source]

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

test_kind_6()[source]

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

test_kind_6_unknown()[source]

Test the returning of kinds from the string name (most of the code copied from test_kind_5()), including the unknown entry.

test_kind_7()[source]

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

test_kind_7_unknown()[source]

Test the functions returning the list of kinds, symbols, … including the unknown entry.

test_kind_8()[source]

Test the ase_refine_cell() function

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

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestStructureDataFromPymatgen(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestStructureDataInit(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.TestStructureDataLock(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests that the structure is locked after storage

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

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

class aiida.backends.tests.test_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.test_dataclasses'
test_clone()[source]

Start from a StructureData object, clone 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.test_dataclasses.TestTrajectoryData(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the TrajectoryData objects.

__module__ = 'aiida.backends.tests.test_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.test_dataclasses.has_seekpath()[source]

Check if there is the seekpath dependency

Returns:True if seekpath is installed, False otherwise
aiida.backends.tests.test_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.test_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.test_dbimporters.TestCodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the CodDbImporter class.

__module__ = 'aiida.backends.tests.test_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.test_dbimporters.TestMpodDbImporter(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the MpodDbImporter class.

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

Tests the creation of MpodEntry from MpodSearchResults.

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the UpfEntry class.

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

Tests the creation of NnincEntry from NnincSearchResults.

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the PcodDbImporter class.

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

Tests the creation of PcodEntry from PcodSearchResults.

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the TcodDbImporter class.

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

Tests the creation of TcodEntry from TcodSearchResults.

Tests for the export and import routines.

class aiida.backends.tests.test_export_and_import.TestCalculations(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Calculations

__module__ = 'aiida.backends.tests.test_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_calcfunction(**kwargs)
test_workcalculation(**kwargs)
class aiida.backends.tests.test_export_and_import.TestCode(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Codes

__module__ = 'aiida.backends.tests.test_export_and_import'

Get all Node links currently in the DB

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_input_code(**kwargs)
test_solo_code(**kwargs)
test_that_solo_code_is_exported_correctly(**kwargs)
class aiida.backends.tests.test_export_and_import.TestComments(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Comments

__module__ = 'aiida.backends.tests.test_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_calc_and_data_nodes_with_comments(**kwargs)
test_exclude_comments_flag(**kwargs)
test_import_arg_comment_mode(**kwargs)
test_mtime_of_imported_comments(**kwargs)
test_multiple_imports_for_single_node(**kwargs)
test_multiple_user_comments_for_single_node(**kwargs)
test_reimport_of_comments_for_single_node(**kwargs)
class aiida.backends.tests.test_export_and_import.TestComplex(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test complex ex-/import cases

__module__ = 'aiida.backends.tests.test_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_complex_graph_import_export(**kwargs)
test_reexport(**kwargs)
class aiida.backends.tests.test_export_and_import.TestComputer(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Computers

__module__ = 'aiida.backends.tests.test_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(**kwargs)
test_different_computer_same_name_import(**kwargs)
test_import_of_django_sqla_export_file(**kwargs)[source]

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

test_same_computer_different_name_import(**kwargs)
test_same_computer_import(**kwargs)
class aiida.backends.tests.test_export_and_import.TestExtras(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Extras

__module__ = 'aiida.backends.tests.test_export_and_import'
import_extras(mode_new='import')[source]

Import an aiida database

modify_extras(mode_existing)[source]

Import the same aiida database again

setUp()[source]

This function runs before every test execution

classmethod setUpClass(*args, **kwargs)[source]

Only run to prepare an export file

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

classmethod tearDownClass(*args, **kwargs)[source]

Remove tmp_folder

test_absence_of_extras()[source]

Check whether extras are not imported if the mode is set to ‘none’

test_extras_import_mode_correct()[source]

Test all possible import modes except ‘ask’

test_extras_import_mode_keep_existing()[source]

Check if old extras are not modified in case of name collision

test_extras_import_mode_mirror()[source]

Check if old extras are fully overwritten by the imported ones

test_extras_import_mode_none()[source]

Check if old extras are fully overwritten by the imported ones

test_extras_import_mode_strange()[source]

Check a mode that is probably does not make much sense but is still available

test_extras_import_mode_update_existing()[source]

Check if old extras are modified in case of name collision

test_extras_import_mode_wrong()[source]

Check a mode that is wrong

test_import_of_extras()[source]

Check if extras are properly imported

class aiida.backends.tests.test_export_and_import.TestGroups(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Groups

__module__ = 'aiida.backends.tests.test_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_group_export(**kwargs)
test_group_import_existing(**kwargs)
test_nodes_in_group(**kwargs)

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Links

__module__ = 'aiida.backends.tests.test_export_and_import'
construct_complex_graph(export_combination=0, work_nodes=None, calc_nodes=None)[source]

This method creates a “complex” graph with all available link types: INPUT_WORK, INPUT_CALC, CALL_WORK, CALL_CALC, CREATE, and RETURN and returns the nodes of the graph. It also returns various combinations of nodes that need to be extracted but also the final expected set of nodes (after adding the expected predecessors, desuccessors).

Get all Node links currently in the DB

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_complex_workflow_graph_export_sets(**kwargs)
test_data_create_reversed_false(**kwargs)
class aiida.backends.tests.test_export_and_import.TestLogs(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Logs

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

Reset database prior to all tests

tearDown()[source]

Delete all the created log entries

test_exclude_logs_flag(**kwargs)
test_export_import_of_critical_log_msg_and_metadata(**kwargs)
test_export_of_imported_logs(**kwargs)
test_multiple_imports_for_single_node(**kwargs)
test_reimport_of_logs_for_single_node(**kwargs)
class aiida.backends.tests.test_export_and_import.TestProvenanceRedesign(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Check changes in database schema after upgrading to v0.4 (Provenance Redesign) This includes all migrations from “base_data_plugin_type_string” (django: 0008) until “dbgroup_type_string_change_content” (django: 0022), both included.

The effects of the large db migration “provenance_redesign” (django: 0020) is tested in TestLinks, since the greatest change concerns links.

__module__ = 'aiida.backends.tests.test_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_base_data_type_change(**kwargs)
test_code_type_change(**kwargs)
test_group_name_and_type_change()[source]

Group’s name and type columns have changed Change for columns: “name” –> “label” “type” –> “type_string” Furthermore, type_strings have been updated to: “” –> “user” “data.upf.family” –> “data.upf” “aiida.import” –> “auto.import” “autogroup.run” –> “auto.run”

The new columns are called on group instances, and will fail if not present. A user created Group is validated to have the “user” value as a type_string. A UPF file is created and imported/uploaded as a UPF family, in order to create a Group with type_string=”data.upf”. Any import will create a Group with type_string “auto.import”, which is checked. The type_string=”auto.run” is not directly checked, but if the three checks above succeed, it is understood that “auto.run” is also correctly ex-/imported as the type_string content for the relevant Groups.

test_node_process_type(**kwargs)
class aiida.backends.tests.test_export_and_import.TestSimple(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test simple ex-/import cases

__module__ = 'aiida.backends.tests.test_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_base_data_nodes(**kwargs)
test_calc_of_structuredata(**kwargs)
test_check_for_export_format_version()[source]

Test the check for the export format version.

test_control_of_licenses()[source]

Test control of licenses.

class aiida.backends.tests.test_export_and_import.TestSpecificImport(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test specific ex-/import cases

__module__ = 'aiida.backends.tests.test_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_cycle_structure_data()[source]

Create an export with some orm.CalculationNode 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.

class aiida.backends.tests.test_export_and_import.TestUsers(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test ex-/import cases related to Users

__module__ = 'aiida.backends.tests.test_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_nodes_belonging_to_different_users(**kwargs)
test_non_default_user_nodes(**kwargs)

Generic tests that need the use of the DB.

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the Code class.

__module__ = 'aiida.backends.tests.test_generic'
test_code_local()[source]
test_remote()[source]
class aiida.backends.tests.test_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.test_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.test_nodes'
__weakref__

list of weak references to the object (if defined)

class aiida.backends.tests.test_nodes.TestNodeBasic(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

__module__ = 'aiida.backends.tests.test_nodes'
boolval = True
dictval = {'emptydict': {}, 'num': 3, 'recursive': {'a': 1, 'b': True, 'c': 1.2, 'd': [1, 2, None], 'e': {'x': None, 'xx': {}, 'yy': [], 'z': 'z'}}, '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_clone()[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_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(**kwargs)[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_uuid_uniquess()[source]

A uniqueness constraint on the UUID column of the Node model should prevent multiple nodes with identical UUID

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.test_nodes.TestNodeCopyDeepcopy(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test that calling copy and deepcopy on a Node does the right thing.

__module__ = 'aiida.backends.tests.test_nodes'
test_copy_not_supported()[source]

Copying a base Node instance is not supported.

test_deepcopy_not_supported()[source]

Deep copying a base Node instance is not supported.

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

Bases: aiida.backends.testbase.AiidaTestCase

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

I get 2 lists of uuids

Parameters:
  • uuids_check_existence – The list of uuids that have to exist
  • uuids_check_deleted – 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 ProcessNode that was called by another ProcessNode 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_non_existing_pk()[source]

Verify that passing a non-existing pk should not raise.

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.test_nodes.TestNodeHashing(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests the functionality of hashing a node

__module__ = 'aiida.backends.tests.test_nodes'
static create_folderdata_with_empty_file()[source]
static create_folderdata_with_empty_folder()[source]
static create_simple_node(a, b=0, c=0)[source]
test_file_same()[source]
test_folder_file_different()[source]
test_folder_same()[source]
test_node_uuid_hashing_for_querybuidler()[source]

QueryBuilder results should be reusable and shouldn’t brake hashing.

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.test_nodes.TestNodeIsStorable(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test if one can store specific Node subclasses, and that Node and ProcessType are not storable, intead.

__module__ = 'aiida.backends.tests.test_nodes'
test_storable_unstorable()[source]

Test storability of Nodes

class aiida.backends.tests.test_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.test_nodes'
test_with_subclasses()[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_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

When the uniqueness constraints on links are reimplemented on the database level, auto generation of labels that relies directly on those database level constraints should be reinstated and tested for here.

It is possible to store links between nodes even if they are unstored these links are cached.

Test the auto generation of link labels when labels are no longer required to be explicitly specified.

Cannot have two CREATE links for the same node.

Test that the link_type parameter in get_incoming and get_outgoing 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

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

Bases: aiida.backends.testbase.AiidaTestCase

Test the transitive closure functionality

__module__ = 'aiida.backends.tests.test_nodes'
test_loop_not_allowed()[source]
class aiida.backends.tests.test_nodes.TestTypes(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Generic test class to test types

__module__ = 'aiida.backends.tests.test_nodes'
test_uuid_type()[source]

Checking whether the UUID is returned as a string. In old implementations it was returned as uuid type

Tests for specific subclasses of Data

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

Bases: exceptions.Exception

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

list of weak references to the object (if defined)

class aiida.backends.tests.test_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.

__module__ = 'aiida.backends.tests.test_parsers'
longMessage = True
read_test(outfolder)[source]
classmethod return_base_test(folder)[source]
class aiida.backends.tests.test_parsers._TestParserMeta[source]

Bases: type

Some python black magic to dynamically create tests

__module__ = 'aiida.backends.tests.test_parsers'
static __new__(cls, name, bases, attrs)[source]
aiida.backends.tests.test_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.test_parsers._comparison_Equal(testclass, dbdata, comparisondata)[source]

Compare two objects to see if they are equal

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

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

aiida.backends.tests.test_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.test_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.test_plugin_loader.TestExistingPlugins(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the get_entry_points function and the plugin Factories.

Will fail when:

  • If get_entry_points returns something other than a list
  • Any of the plugins, distributed with aiida or installed from external plugin repositories, fail to load
__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_dbimporters()[source]

Test listing all preinstalled dbimporter plugins.

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.

Tests for the QueryBuilder.

class aiida.backends.tests.test_query.QueryBuilderDateTimeAttribute(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_query'
test_create_node_and_query()[source]

Testing whether creating nodes within a iterall iteration changes the results.

test_len_results()[source]

Test whether the len of results matches the count returned. See also https://github.com/aiidateam/aiida_core/issues/1600 SQLAlchemy has a deduplication strategy that leads to strange behavior, tested against here

class aiida.backends.tests.test_query.TestManager(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_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.test_query.TestQueryBuilder(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

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

test_append_validation()[source]
test_list_behavior()[source]
test_operators_eq_lt_gt()[source]
test_ormclass_type_classification()[source]

This tests the classifications of the QueryBuilder

test_process_query()[source]

Test querying for a process class.

test_process_type_classification()[source]

This tests the classifications of the QueryBuilder

test_simple_query_1()[source]

Testing a simple query

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

Bases: aiida.backends.testbase.AiidaTestCase

In this class corner cases of QueryBuilder are added.

__module__ = 'aiida.backends.tests.test_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.test_query.TestQueryHelp(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.test_query'
test_queryhelp()[source]

Here I test the queryhelp by seeing whether results are the same as using the append method. I also check passing of tuples.

Unittests for REST API

class aiida.backends.tests.test_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.test_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]
classmethod process_dummy_data()[source]

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

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

Check whether response matches expected values.

Parameters:
  • entity_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(*args, **kwargs)[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.test_restapi.RESTApiTestSuite(methodName='runTest')[source]

Bases: aiida.backends.tests.test_restapi.RESTApiTestCase

Define unittests for rest api

__module__ = 'aiida.backends.tests.test_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_calculation_iotree()[source]

Get filtered inputs list for given calculations

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_comp_orderby_scheduler_ascsign()[source]

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

test_complist_pagelimitoffset_perpage()[source]

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

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_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_schedulertype_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

test_visualization()[source]

Get the list of given calculation inputs

test_xsf_visualization()[source]

Get the list of given calculation inputs

Tests for TestTcodDbExporter

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests for TcodDbExporter class.

__module__ = 'aiida.backends.tests.test_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()[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()[source]
test_symmetry_reduction()[source]