autowisp.tests.test_evaluator module

Class Inheritance Diagram

Inheritance diagram of Evaluator, EvaluatorBase, LightCurveEvaluator, SimpleNamespace, TestErrorHandling, TestNanAggregates, TestRemovedNames

Tests for the symbol table every AutoWISP expression is evaluated in.

Evaluator and LightCurveEvaluator are siblings deriving from EvaluatorBase, and roughly two dozen modules build one. What they offer is therefore worth pinning in one place: the names AutoWISP adds, the names it takes away, and what happens to a bad expression.

class autowisp.tests.test_evaluator.TestErrorHandling(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_evaluator.TestErrorHandling

A bad expression raises rather than evaluating to None.

test_permissive_behaviour_remains_available()[source]

Callers that want the old behaviour can still ask for it.

test_raises_by_default_in_both_evaluators()[source]

Asteval’s default returns None, relocating the failure.

class autowisp.tests.test_evaluator.TestNanAggregates(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_evaluator.TestNanAggregates

The NaN-ignoring aggregates are available and are numpy’s.

test_a_missing_numpy_name_would_fail_loudly()[source]

The list is explicit so that numpy dropping one is an error.

test_bound_to_the_numpy_functions()[source]

A name resolving to something else would be worse than absent.

test_data_shadows_an_aggregate_of_the_same_name()[source]

The data is what the user is asking about.

Binding happens before the data is loaded precisely so that this works; the reverse order would make a diagnostic unreachable.

test_present_in_both_evaluators()[source]

Checked in both, since they used to differ.

LightCurveEvaluator defined two of these and Evaluator none, so which aggregates worked depended on which one you were in.

class autowisp.tests.test_evaluator.TestRemovedNames(methodName='runTest')[source]

Bases: TestCase

Inheritance diagram of autowisp.tests.test_evaluator.TestRemovedNames

Names asteval offers that AutoWISP takes away.

test_absent_from_both_evaluators()[source]

Removed on the shared base, so neither can reach them.

test_filesystem_access_raises()[source]

Asteval permits reading files; AutoWISP does not.

Its open already refuses every mode but reading, so this is about reading: expressions travel between installations in export files, and a shared one must not be able to read arbitrary files.

test_printing_raises()[source]

A side effect rather than a value.

test_the_mathematical_names_survive()[source]

The removals must not cost anything anyone would write.

autowisp.tests.test_evaluator._lightcurve_evaluator()[source]

Return a LightCurveEvaluator over a lightcurve with no datasets.

Only elements["dataset"] is consulted during construction, so a stand-in avoids needing a lightcurve file to check the symbol table.