aiida.backends.tests.orm package

Submodules

Unit tests for the AuthInfo ORM class.

class aiida.backends.tests.orm.test_authinfos.TestAuthinfo(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Unit tests for the AuthInfo ORM class.

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

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

test_delete()[source]

Test deleting a single AuthInfo.

test_set_auth_params()[source]

Test the auth_params setter.

Unit tests for the Comment ORM class.

class aiida.backends.tests.orm.test_comments.TestComment(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Unit tests for the Comment ORM class.

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

Test deleting a Comment through the collection.

test_comment_collection_delete_all()[source]

Test deleting all Comments through the collection.

test_comment_collection_delete_many()[source]

Test deleting many Comments through the collection.

test_comment_collection_get()[source]

Test retrieving a Comment through the collection.

test_comment_content()[source]

Test getting and setting content of a Comment.

test_comment_mtime()[source]

Test getting and setting mtime of a Comment.

test_comment_node()[source]

Test getting the node of a Comment.

test_comment_querybuilder()[source]

Test querying for comments by joining on nodes in the QueryBuilder.

test_comment_user()[source]

Test getting the user of a Comment.

test_objects_get()[source]

Test getting a comment from the collection

Tests for the Computer ORM class.

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

Bases: aiida.backends.testbase.AiidaTestCase

Tests for the Computer ORM class.

__module__ = 'aiida.backends.tests.orm.test_computers'
test_delete()[source]

Test the deletion of a Computer instance.

test_get_transport()[source]

Test the get_transport method of Computer

class aiida.backends.tests.orm.test_computers.TestComputerConfigure(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for the configuring of instance of the Computer ORM class.

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

Prepare current user and computer builder with common properties.

test_configure_local()[source]

Configure a computer for local transport and check it is configured.

test_configure_ssh()[source]

Configure a computer for ssh transport and check it is configured.

test_configure_ssh_invalid()[source]

Try to configure computer with invalid auth params and check it fails.

Test for general backend entities

class aiida.backends.tests.orm.test_entities.TestBackendEntitiesAndCollections(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test backend entities and their collections

__module__ = 'aiida.backends.tests.orm.test_entities'
test_collections_cache()[source]

Make sure that we’re not recreating collections each time .objects is called

test_collections_count()[source]

Make sure count() works for collections

Test for the Group ORM class.

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

Bases: aiida.backends.testbase.AiidaTestCase

Test backend entities and their collections

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

Remove all existing Groups.

test_add_nodes()[source]

Test different ways of adding nodes.

test_clear()[source]

Test the clear method to remove all nodes.

test_count()[source]

Test the count method.

test_creation()[source]

Test the creation of Groups.

test_delete()[source]

Test Group deletion.

test_description()[source]

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

test_group_uuid_hashing_for_querybuidler()[source]

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

test_name_desc()[source]

Test Group description.

test_node_iterator()[source]

Test the indexing and slicing functionality of the node iterator.

test_remove_nodes()[source]

Test node removal.

test_rename()[source]

Test the renaming of a Group.

test_rename_existing()[source]

Test that renaming to an already existing name is not permitted.

ORM Log tests

class aiida.backends.tests.orm.test_logs.TestBackendLog(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Test the Log entity

__module__ = 'aiida.backends.tests.orm.test_logs'
create_log()[source]
setUp()[source]

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

tearDown()[source]

Delete all the created log entries

test_create_log_message()[source]

Test the manual creation of a log entry

test_create_log_unserializable_metadata()[source]

Test that unserializable data will be removed before reaching the database causing an error.

test_db_log_handler()[source]

Verify that the db log handler is attached correctly by firing a log message through the regular logging module attached to a calculation node

test_find_filter()[source]

Test the filter option of log.find

test_find_limit()[source]

Test the limit option of log.find

test_find_orderby()[source]

Test the order_by option of log.find

test_log_collection_delete_all()[source]

Test deleting all Log entries through collection

test_log_collection_delete_many()[source]

Test deleting many Logs through the collection.

test_log_delete_single()[source]

Test that a single log entry can be deleted through the collection.

test_log_querybuilder()[source]

Test querying for logs by joining on nodes in the QueryBuilder

test_objects_find()[source]

Put logs in and find them

test_raise_wrong_metadata_type_error()[source]

Test a TypeError exception is thrown with string metadata. Also test that metadata is correctly created.

Tests for the ORM mixin classes.

class aiida.backends.tests.orm.test_mixins.TestSealable(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Tests for the Sealable mixin class.

__module__ = 'aiida.backends.tests.orm.test_mixins'
static test_change_updatable_attrs_after_store()[source]

Verify that a Sealable node can alter updatable attributes even after storing.

test_validate_incoming_sealed()[source]

Verify that trying to add a link to a sealed node will raise.

test_validate_outgoing_sealed()[source]

Verify that trying to add a link from a sealed node will raise.

Tests for the QueryBuilder.

class aiida.backends.tests.orm.test_querybuilder.QueryBuilderJoinsTests(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.orm.test_querybuilder'
test_joins1()[source]
test_joins2()[source]
test_joins3_user_group()[source]
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.orm.test_querybuilder.QueryBuilderLimitOffsetsTest(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

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

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.orm.test_querybuilder'
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.orm.test_querybuilder.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.orm.test_querybuilder'
test_statistics_default_class()[source]
class aiida.backends.tests.orm.test_querybuilder.TestManager(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

__module__ = 'aiida.backends.tests.orm.test_querybuilder'
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.orm.test_querybuilder.TestMultipleProjections(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

Unit tests for the QueryBuilder ORM class.

__module__ = 'aiida.backends.tests.orm.test_querybuilder'
test_first_multiple_projections()[source]

Test first() returns correct types and numbers for multiple projections.

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

Bases: aiida.backends.testbase.AiidaTestCase

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

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

test_append_validation()[source]
test_direction_keyword()[source]

The direction keyword is a special case with the QueryBuilder append method, so some tests are good.

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.orm.test_querybuilder.TestQueryBuilderCornerCases(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

In this class corner cases of QueryBuilder are added.

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

In this test we check the correct behavior of QueryBuilder when retrieving the _metadata 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.orm.test_querybuilder.TestQueryHelp(methodName='runTest')[source]

Bases: aiida.backends.testbase.AiidaTestCase

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

test_recreate_from_queryhelp()[source]

Test recreating a QueryBuilder from the Query Help