autowisp.tests.test_diagnostic_expressions module

Class Inheritance Diagram

Inheritance diagram of DiagnosticExpression, DiagnosticExpressionTestCase, IntegrityError, Path, TestLibraryAccess, TestNameSpace, TestStoredFields, ValidationError

Tests for stored diagnostic expressions.

Only what is specific to the model lives here. That it carries created and modified, and that they are maintained however the row is written, is covered once for every browser-interface model by test_bui_models.

class autowisp.tests.test_diagnostic_expressions.DiagnosticExpressionTestCase(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_diagnostic_expressions.DiagnosticExpressionTestCase

Base migrating the throwaway browser-interface database.

make(name, expression='astrom_residual / diagonal_fov')[source]

Store one expression.

setUp()[source]

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

classmethod setUpClass()[source]

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

class autowisp.tests.test_diagnostic_expressions.TestLibraryAccess(methodName='runTest')[source]

Bases: DiagnosticExpressionTestCase

Inheritance diagram of autowisp.tests.test_diagnostic_expressions.TestLibraryAccess

get_expressions – the whole of tier 3.

What it produces is the {name: expression} dictionary tiers 1 and 2 take as an argument, so these assert the shape of that hand-off rather than anything about expressions, which is tested where the rules live.

test_empty_library_is_a_dictionary()[source]

Not None: the tiers below iterate it without checking.

test_names_map_to_their_text()[source]

The shape tiers 1 and 2 expect, and nothing more.

test_the_whole_library_regardless_of_what_resolves()[source]

Filtering by project would need a project, which tier 3 lacks.

An expression naming a diagnostic nothing has recorded is not an error; it is simply not offered where it cannot be drawn, and deciding that belongs to whoever holds the project’s names.

class autowisp.tests.test_diagnostic_expressions.TestNameSpace(methodName='runTest')[source]

Bases: DiagnosticExpressionTestCase

Inheritance diagram of autowisp.tests.test_diagnostic_expressions.TestNameSpace

Names have to behave like the diagnostic names they sit beside.

test_a_slug_name_is_accepted()[source]

The names the documentation suggests actually validate.

test_name_is_unique()[source]

Two expressions cannot share a name.

The name is what a selector and a URL carry, and what other expressions reference, so a duplicate would be ambiguous in three places at once.

test_name_must_survive_a_url()[source]

Rejected unless it is a slug.

Expressions are selected through image/<slug:x>/vs/<slug:y>, so a name outside the slug charset could be stored but never plotted.

class autowisp.tests.test_diagnostic_expressions.TestStoredFields(methodName='runTest')[source]

Bases: DiagnosticExpressionTestCase

Inheritance diagram of autowisp.tests.test_diagnostic_expressions.TestStoredFields

What the model keeps, and what it deliberately does not check.

test_description_is_optional()[source]

Most expressions are self-explanatory from their text.

test_ordering_is_by_name()[source]

The management page lists them alphabetically.

test_str_is_the_name()[source]

What the admin and any error message will show.

test_unknown_names_are_not_rejected_here()[source]

The model stores text; resolving names is not its job.

An expression may legitimately reference diagnostics the open project has never recorded – it is then simply not offered there – so validating against a project database at this level would be wrong.