aiida.backends.tests package¶
Module for defining tests that required access to (a temporary) database
-
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.
Subpackages¶
- aiida.backends.tests.cmdline package
- aiida.backends.tests.common package
- aiida.backends.tests.engine package
- aiida.backends.tests.manage package
- aiida.backends.tests.orm package
- aiida.backends.tests.parsers package
- aiida.backends.tests.plugins package
- aiida.backends.tests.restapi package
- aiida.backends.tests.tools package
- aiida.backends.tests.utils package
Submodules¶
-
class
aiida.backends.tests.test_base_dataclasses.
TestFloat
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_base_dataclasses'¶
-
-
class
aiida.backends.tests.test_base_dataclasses.
TestFloatIntMix
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_base_dataclasses'¶
-
-
class
aiida.backends.tests.test_base_dataclasses.
TestInt
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_base_dataclasses'¶
-
-
class
aiida.backends.tests.test_base_dataclasses.
TestList
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_base_dataclasses'¶
-
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_transport
()[source]¶ Test that we can get the Transport object from the calculation instance.
-
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'¶
-
-
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'¶
-
-
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.
-
__module__
= 'distutils.version'¶
-
__str__
()¶ Return str(self).
-
_cmp
(other)¶
-
parse
(vstring)¶
-
version_re
= re.compile('^(\\d+) \\. (\\d+) (\\. (\\d+))? ([ab](\\d+))?$', re.VERBOSE|re.ASCII)¶
-
-
__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_cif_with_long_line
()[source]¶ Tests CifData - check that long lines (longer than 2048 characters) are supported. Should not raise any error.
-
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
-
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'¶
-
-
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'¶
-
-
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'¶
-
-
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
-
-
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_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_kindnames
()[source]¶ Tests roundtrip StructureData -> pymatgen -> StructureData (no spins, but with all kind of kind names)
-
-
class
aiida.backends.tests.test_dataclasses.
TestSeekpathExplicitPath
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_dataclasses'¶
-
-
class
aiida.backends.tests.test_dataclasses.
TestSeekpathPath
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_dataclasses'¶
-
-
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'¶
-
-
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
-
-
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_unknown_atoms
()[source]¶ Test the creation of a cell and the appending of atoms, including the unknown entry.
-
test_kind_1_unknown
()[source]¶ Test the management of kinds (automatic detection of kind of simple atoms), inluding the unknown entry.
-
test_kind_2_unknown
()[source]¶ Test the management of kinds (manual specification of kind name), including the unknown entry.
-
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_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.
-
-
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_conversion_of_types_2
()[source]¶ Tests roundtrip ASE -> StructureData -> ASE, with tags, and changing the atomic masses
-
test_conversion_of_types_4
()[source]¶ Tests ASE -> StructureData -> ASE, in particular conversion 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
-
-
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'¶
-
-
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'¶
-
-
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'¶
-
-
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.
-
-
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.
-
-
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'¶
-
-
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'¶
-
-
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'¶
-
-
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'¶
-
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'¶
-
-
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'¶
-
-
class
aiida.backends.tests.test_nodes.
AnyValue
[source]¶ Bases:
object
Helper class that compares equal to everything.
-
__dict__
= mappingproxy({'__module__': 'aiida.backends.tests.test_nodes', '__doc__': '\n Helper class that compares equal to everything.\n ', '__eq__': <function AnyValue.__eq__>, '__dict__': <attribute '__dict__' of 'AnyValue' objects>, '__weakref__': <attribute '__weakref__' of 'AnyValue' objects>, '__hash__': None})¶
-
__hash__
= None¶
-
__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_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_attribute_mutability
()[source]¶ Attributes of a node should be immutable after storing, unless the stored_check is disabled in the call
-
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_delete_extras
()[source]¶ Checks the ability of deleting extras, also when they are dictionaries or lists.
-
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.
-
-
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'¶
-
-
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_indep2w_graph
()[source]¶ Creates a simple graph with one workflow handling two independent workflows (with one simple calculation each). It was designed and used mainly to point out how the deletion behaviour works when setting call_work_forward to true: in this case if PWA is deleted, the somewhat independent PWB will also be deleted. Even worse, if call_calc_forward was also enabled, even the data provenance controlled by PWB (PCB and DOB) would be deleted as well. The graph is composed of the following nodes:
PW0: parent workflow, which calls both PWA and PWB.
PWA: it has a single call to PCA, with input DIA and output DOA.
PWB: it has a single call to PCB, with input DIB and output DOB.
This should look something like this (you can find a nicer version of this graph in the documentation, as it is the same used to explain the consistency rules):
+-------------------------------------+ +-------------------------------------+ | inwork | | inwork | | v v | | call_work +-------+ call_work | | +---------------- | PW0 | -----------------+ | | | +-------+ | | | v | | v | | inwork +---+ return | | return +---+ inwork | | +-----------> |PWA| ------------+ | | +-----------> |PWB| ------------+ | | | +---+ | | | | +---+ | | | | | | | | | | | | | | | call_calc | | | | | call_calc | | | | | | | | | | | | | | v v v v v v | | +-----+ incall +---+ create +-----+ +-----+ create +---+ incall +-----+ | DIA | --------> |PCA| --------> | DOA | | DOB | <-------- |PCB| <-------- | DIB | +-----+ +---+ +-----+ +-----+ +---+ +-----+
-
_create_long_graph
(total_calcs)[source]¶ Creates a straighforward graph with the required number of calculation nodes. All these calculation nodes are connected through a series of data nodes, starting with a data node D0 as the first input and each calculation C(N) will have data node D(N-1) as an input and data node D(N) as an output. The final graph looks like this:
+----+ +----+ +----+ +----+ +----+ | D0 | --> | C1 | --> | D1 | --> | C2 | --> | D2 | --> ... +----+ +----+ +----+ +----+ +----+
-
_create_looped_graph
()[source]¶ Creates a basic graph with one parent workflow (PWM) which first calls a child workflow (PWS) to choose one input from a set (DI1 from DI1-DI3), and then use it to perform a calculation (PCS) and obtain an output (DO1). The node PWM will call both PWS and PCS itself. The final graph looks like this:
+-----+ input_work +-----+ return | DI3 | --+------------> | PWM | -----------------+-----------------+ +-----+ | +-----+ | | | | | | | | call_work | | | v | | +-----+ | input_work +-----+ | | | DI2 | --+------------> | PWS | | call_calc | +-----+ | +-----+ | | | | | | | (CYCLE) | return | | | v v v | +-----+ input_calc +-----+ create +-----+ +------------- | DI1 | ------------> | PCS | --------> | DO1 | +-----+ +-----+ +-----+
-
_create_simple_graph
()[source]¶ Creates a simple graph which has one parent workflow (WN2) that calls a child workflow (WN1) and then a calculation (CN2). The child workflow (WN1) calls its own calculation (CN1). There is one input data node (DNI), on middle data node (DNM) and one output data node (DNO). There is at least one link of each type and there are two “one-step” calculation calls (WN1 -> CN1 and WN2 -> CN2) and one “two-step” calculation call (WN2 -> WN1 -> CN1).
The existing links are:
CALL_WORK from WN2 to WN1.
CALL_CALC from WN2 to CN2.
CALL_CALC from WN1 to CN1.
INPUT_WORK from DNI to WN1 and RETURN from WN1 to DNM.
INPUT_WORK from DNI to WN2 and RETURN from WN2 to DNO.
INPUT_CALC from DNI to CN1 and CREATE from CN1 to DNM.
INPUT_CALC from DNM to CN2 and CREATE from CN2 to DNO.
And this graph looks like this:
input_work +-----+ return +---------------------------------> | WN2 | ----------------------------------+ | +-----+ | | call_work | call_calc | | +-----------------+--------------------+ | | | | | | v | | | input_work +-----+ return | | +---------------> | WN1 | -------------+ | | | +-----+ | | | | | | | | | | call_calc | | | | | | | | | v v v v +-----+ input_calc +-----+ create +-----+ input_calc +-----+ create +-----+ | DNI | -----------> | CN1 | --------> | DNM | -----------> | CN2 | --------> | DNO | +-----+ +-----+ +-----+ +-----+ +-----+
-
test_delete_cases
()[source]¶ Using a simple graph to test all the conditions established for the consistent deletion of nodes. The first part tests the default behavior, which is to delete every node within the highest level workflows that link to the targetted nodes (except for non targetted inputs). The second part tests the available options to customize deletion in their expected use cases.
-
test_indep2w
()[source]¶ Using a simple graph, will test the behaviour when deleting an independent workflow that is somehow connected to another one simply by being part of the the same parent workflow (i.e. two workflows connected by the logical provenance but not the data provenance).
-
-
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'¶
-
-
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'¶
-
-
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'¶
-
-
class
aiida.backends.tests.test_nodes.
TestSubNodesAndLinks
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_nodes'¶
-
test_cachelink
()[source]¶ Test the proper functionality of the links cache, with different scenarios.
-
test_link_with_unstored
()[source]¶ It is possible to store links between nodes even if they are unstored these links are cached.
-
test_node_get_incoming_outgoing_links
()[source]¶ 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
-
-
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'¶
-
-
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'¶
-
Tests for the QueryBuilder.
-
class
aiida.backends.tests.test_query.
QueryBuilderJoinsTests
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
test_joins_group_node
()[source]¶ This test checks that the querying for the nodes that belong to a group works correctly (using QueryBuilder). This is important for the Django backend with the use of aldjemy for the Django to SQLA schema translation. Since this is not backend specific test (even if it is mainly used to test the querying of Django backend with QueryBuilder), we keep it at the general tests (ran by both backends).
-
-
class
aiida.backends.tests.test_query.
QueryBuilderLimitOffsetsTest
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
class
aiida.backends.tests.test_query.
QueryBuilderPath
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
class
aiida.backends.tests.test_query.
TestAttributes
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
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.
TestDoubleStar
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
In this test class we check if QueryBuilder returns the correct results when double star is provided as projection.
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
class
aiida.backends.tests.test_query.
TestManager
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
class
aiida.backends.tests.test_query.
TestQueryBuilder
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
test_direction_keyword
()[source]¶ The direction keyword is a special case with the QueryBuilder append method, so some tests are good.
-
-
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'¶
-
-
class
aiida.backends.tests.test_query.
TestQueryHelp
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
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/v4'¶
-
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
-
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. incoming, outgoing
-
-
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_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_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_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_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)
-