armi.matProps.tests.test_symbolicFunction module

Unit tests for the symbolic function class.

class armi.matProps.tests.test_symbolicFunction.TestSymbolicFunction(methodName='runTest')[source]

Bases: TestCase

Unit tests for the symbolic function class.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

loadMaterial(num=1)[source]

Loads the material file based on self.yaml and returns the material object.

functionTest(func, num=1)[source]

Takes a function as input to compare against matProps material output. It is assumed that self.yaml has been updated to match the provided evaluation function.

setEqnField(eqn)[source]
test_symbolicMult()[source]

Test multiplication operator for symbolic equations.

Four combinations of spacing and the operator are tested for multiplying a variable and a constant as well as multiplying two variables. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicExponent()[source]

Test exponent operator for symbolic equations.

Four combinations of spacing and the operator are tested for raising a variable by a constant as well as raising a constant by a constant. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicDiv()[source]

Test division operator for symbolic equations.

The four combinations of spacing and the operator are tested for dividing a variable and a constant as well as dividing two variables. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicAdd()[source]

Test addition operator for symbolic equations.

Four combinations of spacing and the operator are tested for adding a variable and a constant as well as adding two variables. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicSub()[source]

Test subtraction operator for symbolic equations.

Four combinations of spacing and the operator are tested for subtracting a variable and a constant as well as subtracting two variables. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicParens()[source]

Test the grouping operator for symbolic equations.

Various combinations of grouping is tested with spacing on a simple addition operation. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicSine()[source]

Test sine operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicCosine()[source]

Test cosine operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicTan()[source]

Test tangent operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicSinh()[source]

Test hyperbolic sine operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicCosh()[source]

Test hyperbolic cosine operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicTanh()[source]

Test hyperbolic tangent operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicNatLog()[source]

Test natural logarithm operator for symbolic equations.

Both log and ln variations of the function name are tested. Four combinations of spacing and the operator are tested for each function name. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicLog10()[source]

Test base ten logarithm operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicExp()[source]

Test exponential operator for symbolic equations.

Four combinations of spacing and the operator are tested. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicComposition()[source]

Test composition of functions for symbolic equations.

Four different functions are tested that are composites of other functions. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicOrdop()[source]

Test order of operations for symbolic equations.

Five different equations are evaluated that test different components of order precedence. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicWhitespace()[source]

Test excess whitespace is ignored for symbolic equations.

Two different equations are evaluated with varying amounts of whitespace introduced to ensure they produce the same results. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range of the property.

test_symbolicIntFloat()[source]

Test handling of integers and floats for symbolic equations.

Multiple equations are tested that verify that when integers are used in equations they do not result in integer multiplication and division in Python and are instead treated as floating point numbers. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicBadParens()[source]

Test unbalanced parentheses results in errors for symbolic equations.

Multiple equations are tested that verify that various combinations of unbalanced parentheses are detected and result in an error when parsing the input. Additionally, an expression with extraneous but balanced parentheses is tested for correctness. For that input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicUndefined()[source]

Test that undefined functions results in errors for symbolic equations.

A logarithmic function is evaluated at two points in the valid range to show that the material input is parsed correctly. The function is then evaluated at a value that results in a negative expression inside the logarithm which is undefined.

test_symbolicCaps()[source]

Test bad capitalization results in errors for symbolic equations.

Multiple equations are tested that verify that various combinations of capitalization are detected and result in an error when parsing the inputs.

test_symbolicImpmult()[source]

Test implicit multiplication results in errors for symbolic equations.

Multiple equations are tested that verify that various combinations of implicit multiplication are detected and result in an error when parsing the inputs.

test_symbolicVarVar()[source]

Test repeat variables for symbolic equations.

Multiple equations are tested that verify that various combinations of repeat variable usage evaluate correctly. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicScientific()[source]

Test scientific notation for symbolic equations.

Multiple equations are tested that verify that various combinations of both upper and lower case scientific notation evaluate correctly. For each input, the property is evaluated at 20 evenly spaced points per independent variable within the valid range.

test_symbolicExamples()[source]

Test a handful of complicated symbolic equations.

test_symbolicBadparse()[source]

Test incorrect expressions results in errors for symbolic equations.

test_pickleSymbolicFunction()[source]

Downstream usages might need to pickle a material. Ensure symbolic expression can be pickled.

test_numpyEvals()[source]

Test that numpy floats and integers work in evaluations same as integers and floats.

test_largeExponentials()[source]

Test that exponentials don’t overflow.

test_symbolicOutofbounds()[source]

Test evaluation outside of bounds results in ValueError for symbolic equations.

class armi.matProps.tests.test_symbolicFunction.TestBrokenSymbolicFunctions(methodName='runTest')[source]

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_complexNumbers()[source]
test_isNan()[source]