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.
Subpackages¶
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'¶
-
-
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'¶
-
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.4The following are examples of invalid version numbers:
1 2.7.2.2 1.3.a4 1.3pl1 1.3c4The 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_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
-
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
-
-
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.
TestSinglefileData
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
Test the SinglefileData class.
-
__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'¶
-
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'¶
-
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'¶
-
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'¶
-
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'¶
-
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'¶
-
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'¶
-
test_absence_of_extras
()[source]¶ Check whether extras are not imported if the mode is set to ‘none’
-
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
-
-
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'¶
-
test_group_export
(**kwargs)¶
-
test_group_import_existing
(**kwargs)¶
-
test_nodes_in_group
(**kwargs)¶
-
-
class
aiida.backends.tests.test_export_and_import.
TestLinks
(methodName='runTest')[source]¶ 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).
-
test_complex_workflow_graph_export_sets
(**kwargs)¶
-
test_complex_workflow_graph_links
(**kwargs)¶
-
test_data_create_reversed_false
(**kwargs)¶
-
test_double_return_links_for_workflows
(**kwargs)¶
-
test_high_level_workflow_links
(**kwargs)¶
-
test_input_and_create_links
(**kwargs)¶
-
test_links_for_workflows
(**kwargs)¶
-
test_links_to_unknown_nodes
(**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'¶
-
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'¶
-
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'¶
-
test_base_data_nodes
(**kwargs)¶
-
test_calc_of_structuredata
(**kwargs)¶
-
-
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'¶
-
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'¶
-
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'¶
-
-
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__
= 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 '})¶
-
__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_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.
-
-
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_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_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
-
-
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_label_autogenerator
(**kwargs)[source]¶ 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.
-
test_link_with_unstored
()[source]¶ It is possible to store links between nodes even if they are unstored these links are cached.
-
test_links_label_autogenerator
(**kwargs)[source]¶ Test the auto generation of link labels when labels are no longer required to be explicitly specified.
-
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 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¶
-
-
class
aiida.backends.tests.test_parsers.
_TestParserMeta
[source]¶ Bases:
type
Some python black magic to dynamically create tests
-
__module__
= 'aiida.backends.tests.test_parsers'¶
-
-
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'¶
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'¶
-
-
class
aiida.backends.tests.test_query.
QueryBuilderJoinsTests
(methodName='runTest')[source]¶ Bases:
aiida.backends.testbase.AiidaTestCase
-
__module__
= 'aiida.backends.tests.test_query'¶
-
-
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.
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'¶
-
-
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'¶
-
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
-
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
-
-
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_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_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_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
-
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_cmdline_parameters
()[source]¶ Ensuring that neither extend_with_cmdline_parameters() nor deposition_cmdline_parameters() set default parameters.
-
test_contents_encoding_1
()[source]¶ Testing the logic of choosing the encoding and the process of encoding contents.
-