Tests Documentation

  • all tests can be evaluated via pytest

  • executing pytest from the tests directory or above within the repo will execute all tests

  • executing pytest within a specific directory will only execute tests in that directory

  • executing pytest path/to/text_file.py will only execute single specified test

Unit Tests

test_api docu

class helpr.tests.unit_tests.test_api.CycleEvolutionTestCase(methodName='runTest')

class for unit tests of cycle evolution module

setUp()

function to specify common cycle evolution inputs

tearDown()

teardown function

test_a_crit_optimization()

test optimization of a critical for cycle evolution class

test_array_input()

test array input for cycle evolution class

test_default()

test default functionality of cycle evolution class

test_stepping_by_cycles()

test to check capability to numerically integrate in terms of cycles

test_crack_growth docu

class helpr.tests.unit_tests.test_crack_growth.CrackGrowthTestCase(methodName='runTest')

Class for units tests of crack growth module

setUp()

function to specify common inputs to crack growth module

tearDown()

teardown function

test_0pct_h2()

unit test for having no hydrogen in crack growth calculations

test_100pct_h2()

unit test that crack growth following ASME curve

test_bad_crack_growth_model_specifications()

unit test for passing invalid crack growth rate model

test_bad_default()

unit test of default behavior of crack growth module with missing specifications

test_default()

unit test of default behavior of crack growth module

test_design_curve_function()

unit test to check that design curve calculation function performs as expected

test_input_types()

unit test for passing lists of inputs to crack growth module

test_invalid_fugacity_correction_case()

unit test of passing invalid input to fugacity correction

test_specify_paris_law_crack_growth()

unit test of specifying inputs for a paris law crack growth model

test_crack_initiation docu

class helpr.tests.unit_tests.test_crack_initiation.CrackInitiationTestCase(methodName='runTest')

Class for units test of crack initiation module

setUp()

function for specifying common inputs to crack initiation module

tearDown()

teardown function

test_array_inputs()

unit test of passing input arrays to crack initiation module

test_default()

unit test of default functionality of crack initiation module

test_cycle_evolution docu

class helpr.tests.unit_tests.test_cycle_evolution.CycleEvolutionTestCase(methodName='runTest')

class for unit tests of cycle evolution module

setUp()

function to specify common cycle evolution inputs

tearDown()

teardown function

test_a_crit_optimization()

test optimization of a critical for cycle evolution class

test_array_input()

test array input for cycle evolution class

test_default()

test default functionality of cycle evolution class

test_stepping_by_cycles()

test to check capability to numerically integrate in terms of cycles

test_environment docu

class helpr.tests.unit_tests.test_environment.EnvironmentTestCase(methodName='runTest')

Class for unit tests of environment module

setUp()

function to specify common inputs to environment module

tearDown()

teardown function

test_array_input()

unit test of passing array of pressure values to environment module

test_fugacity_ratio()

unit test of fugacity ratio calculation

test_h2_volume_fraction()

unit test of changing h2 mvolume fraction in environment

test_r_ratio()

unit test of r ratio calculation

test_fracture docu

class helpr.tests.unit_tests.test_fracture.FractureTestCase(methodName='runTest')

class for fracture module unit tests

setUp()

function for specifying common fracture module inputs

tearDown()

teardown function

test_default()

unit test of default behavior of fracture module

test_inspection_mitigation docu

class helpr.tests.unit_tests.test_inspection_mitigation.InspectionMitigationTestCase(methodName='runTest')

unit tests for inspection and mitigation module

setUp()

function for specifying common inspection mitigation module inputs

tearDown()

” teardown function

test_crack_inspection()

unit test for crack inspection function

test_crack_mitigation()

unit test for crack mitigation function

test_determine_inspection_schedule()

test of determining inspection schedule function

test_inspection_indices()

test of inspection indices function

test_material docu

class helpr.tests.unit_tests.test_material.MaterialTestCase(methodName='runTest')

class for unit tests of material module

setUp()

function for specifying common material module inputs

tearDown()

teardown function

test_default()

unit test of default behavior for material module

test_single_instance()

unit test of accessing single instance of material specification object

test_parameter docu

class helpr.tests.unit_tests.test_parameter.ParameterTestCase(methodName='runTest')

class for unit test of parameter module

setUp() None

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

tearDown() None

teardown function

test_above_bounds()

unit test of specifying parameter value above upper bound

test_bad_size_specification()

unit test to check that bad size specification does not work

test_below_bounds()

unit test of specifying parameter value below lower bound

test_default()

unit tests of default behavior of parameter module

test_list_above_bounds()

unit test of passing list of inputs with one value above parameter upper bounds

test_list_below_bounds()

unit test of passing list of inputs with one value below parameter lower bounds

test_make_array()

unit test of specifying size of parameter object

test_passed_list()

unit test of passing list of parameter values to parameter module

test_pipe docu

class helpr.tests.unit_tests.test_pipe.PipeTestCase(methodName='runTest')

class for pipe module unit tests

setUp()

function to specify common inputs to pipe module

tearDown()

teardown function

test_array_input()

unit test of passing array of inputs to pipe module

test_bad_pipe_size()

unit tests of bad pipe size specification

test_simple_calcs()

unit test to check simple pipe calculations

test_plots docu

class helpr.tests.unit_tests.test_plots.PlotsTestCase(methodName='runTest')

class for plotting functions

setUp()

function to specify common inputs to plot functions

test_crack_growth_rate_plot()

test for creation of crack growth rate plot

test_cycle_life_cdf_ci()

test for creation of life criteria cdf confidence intervals plot

test_cycle_life_cdfs()

test for creation of life criteria cdfs plot

test_cycle_life_critieria_scatter_plot()

test for creation of life criteria scatter plot

test_cycle_life_pdf()

test for creation of life criteria pdfs plot

test_design_curve_plot()

test for creation of design curve plot

test_failure_assessment_diagram()

test for creation of failure assessment diagram

test_inspection_mitigation_plots()

test for creation of inspection mitigation plots

test_life_assessment_ensemble_plot()

test for creation of life assessment plot for pipe ensemble

test_pipe_life_assessment_plot()

test for creation of life assessment plot for single pipe

test_sensitivity_results_plot()

test for creation of sensitivity plot

test_postprocessing docu

class helpr.tests.unit_tests.test_postprocessing.PostProcessingTestCase(methodName='runTest')

unit test for postprocessing module

setUp()

function to specify common postprocessing inputs

tearDown()

tear down function

test_crack_evolution_plotting()

” test for generating crack evolution plot

test_stress_state docu

class helpr.tests.unit_tests.test_stress_state.StressStateTestCase(methodName='runTest')

class for unit tests of stress state module

setUp()

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

tearDown()

tear down function

test_axial_hoop_stress_check()

unit test of check of axial hoop stress exceeding yield strength

test_axial_hoop_stress_intensity_factor_anderson()

unit test of check of axial longitudinal stress exceeding yield strength via the Anderson analytical calculation method.

test_axial_hoop_stress_intensity_factor_api()

unit test of check of axial longitudinal stress exceeding yield strength voa the API 579-1 calculation method.

test_axial_hoop_stress_state_specification()

unit test of internal axial hoop stress state specification

test_circumferential_longitudinal_stress_check()

unit test of check of axial longitudinal stress exceeding yield strength

test_circumferential_longitudinal_stress_intensity_factor()

unit test of check of axial longitudinal stress exceeding yield strength

test_circumferential_longitudinal_stress_state_specification()

unit test of longitudinal stress states specification

test_generic_stress_state_specification()

unit test of generic stress state state specification

Verification Tests

test_verification_crack_growth_rate docu

class helpr.tests.verification_tests.test_verification_crack_growth_rate.VerificationCrackGrowth(methodName='runTest')

Class for verification tests of crack growth rate calculations

calculate_crack_evolution_error(truth, simulation_data)

function for calculating % rel. err. between predictions and data

calculate_error_metrics(truth, simulation_data)

function for calculating error metrics

setUp()

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

tearDown()

teardown function

test_dataset_1()

“verification test using dataset 1

test_dataset_2()

verification test using dataset 2

test_dataset_3()

verification test using dataset 3

verification_raw_comparison_plot(verification_data, simulation_data, condition)

function for creating verification comparison plots