tests.calculation

Submodules

tests.calculation.test_aperture

class tests.calculation.test_aperture.TestApertureEdgeCases(methodName='runTest')[source]

Bases: TestCase

tests aperture-class with different edge/false and usual input for different radius, amount and end correction types (open/flange).

classmethod setUpClass()[source]

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

test_radius_max_amount_max()[source]
test_radius_max_amount_max_flange()[source]
test_radius_max_amount_max_flange_open()[source]
test_radius_max_amount_max_open_flange()[source]
test_radius_max_amount_mid()[source]
test_radius_max_amount_mid_flange()[source]
test_radius_max_amount_mid_flange_open()[source]
test_radius_max_amount_mid_open_flange()[source]
test_radius_mid_amount_max()[source]
test_radius_mid_amount_max_flange()[source]
test_radius_mid_amount_max_flange_open()[source]
test_radius_mid_amount_max_open_flange()[source]
test_radius_mid_amount_mid_flange_open()[source]
test_radius_mid_amount_mid_open_flange()[source]
test_radius_mid_amount_min()[source]
test_radius_mid_amount_min_flange()[source]
test_radius_mid_amount_min_flange_open()[source]
test_radius_mid_amount_min_open_flange()[source]
test_radius_min_amount_max_flange_open()[source]
test_radius_min_amount_max_open_flange()[source]
test_radius_min_amount_mid()[source]
test_radius_min_amount_mid_flange()[source]
test_radius_min_amount_mid_flange_open()[source]
test_radius_min_amount_mid_open_flange()[source]
test_radius_min_amount_min()[source]
test_radius_min_amount_min_flange()[source]
test_radius_min_amount_min_flange_open()[source]
test_radius_min_amount_min_open_flange()[source]

tests.calculation.test_geometry

class tests.calculation.test_geometry.TestGeometry(methodName='runTest')[source]

Bases: TestCase

Tests formulas for volume calculation with different false/ edge and usaual input

classmethod setUpClass()[source]

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

test_cuboid_max_values()[source]

Test cuboid volume with maximum allowed dimensions

test_cuboid_mid_values()[source]

Test cuboid volume with midpoint dimensions

test_cuboid_min_values()[source]

Test cuboid volume with minimum allowed dimensions

test_cuboid_with_radius_height()[source]

Expect TraitError when cuboid given parameters for cylinder calculation

test_cuboid_x_max()[source]

Test cuboid volume with max x dimension

test_cuboid_x_min()[source]
test_cuboid_x_zero()[source]

Expect TraitError when x dimension is zero

test_cuboid_y_max()[source]

Test cuboid volume with max y dimension

test_cuboid_y_min()[source]

Test cuboid volume with min y dimension

test_cuboid_y_zero()[source]

Expect TraitError when y dimension is zero

test_cuboid_z_max()[source]

Test cuboid volume with max z dimension

test_cuboid_z_min()[source]

Test cuboid volume with min z dimension

test_cuboid_z_zero()[source]

Expect TraitError when z dimension is zero

test_cylinder_height_max()[source]

Test cuboid volume with max height dimension

test_cylinder_height_min()[source]

Test cuboid volume with min height dimension

test_cylinder_height_zero()[source]

Expect TraitError when height is zero

test_cylinder_max_values()[source]

Test cylinder volume with max allowed dimensions

test_cylinder_mid_values()[source]

Test cylinder volume with midpoint dimensions

test_cylinder_min_values()[source]

Test cylinder volume with minimum allowed dimensions

test_cylinder_radius_max()[source]

Test cuboid volume with max radius dimension

test_cylinder_radius_min()[source]

Test cuboid volume with min x dimension

test_cylinder_radius_zero()[source]

Expect TraitError when radius is zero

test_cylinder_with_xyz_parameters()[source]

Expect TraitError when cylinder given parameters for cuboid calculation

test_false_datatype_trait_error()[source]

Expect TraitError when form parameter is not a string

test_height_toosmall()[source]

Expect TraitError when height is below minimum

test_radius_toosmall()[source]

Expect TraitError when radius is below minimum

test_x_toosmall()[source]

Expect TraitError when x is below minimum

test_y_toosmall()[source]

Expect TraitError when y is below minimum

test_z_toosmall()[source]

Expect TraitError when z is below minimum

tests.calculation.test_medium

class tests.calculation.test_medium.TestMedium(methodName='runTest')[source]

Bases: TestCase

Unit Tests für die Medium-Klasse. Testet Randwerte und Out-of-Range-Werte für Temperatur und relative Feuchte.

expected_density(temp_celsius, rel_humidity)[source]

Compute expected air density (kg/m³).

expected_kinematic_viscosity(temp_celsius, rho)[source]

Compute expected kinematic viscosity (m²/s).

expected_speed_of_sound(temp_celsius, rel_humidity)[source]

Compute expected speed of sound (m/s).

expected_temperature_kelvin(temp_celsius)[source]

Compute expected temperature in Kelvin.

classmethod setUpClass()[source]

Liest einmalig die physikalischen Grenzen und Standardwerte aus den Traits der Medium-Klasse aus.

test_humidity_minimally_too_large()[source]

Should raise TraitError if RH is minimally above max.

test_humidity_minimally_too_small()[source]

Should raise TraitError if RH is minimally below min.

test_max_humidity_valid()[source]

Check max RH with default temperature.

test_max_temperature_valid()[source]

Check max temperature with default RH.

test_min_humidity_valid()[source]

Check min RH with default temperature.

test_min_temperature_valid()[source]

Check min temperature with default RH.

test_temp_minimally_too_large()[source]

Should raise TraitError if temperature is minimally above max.

test_temp_minimally_too_small()[source]

Should raise TraitError if temperature is minimally below min.

tests.calculation.test_resonator

class tests.calculation.test_resonator.TestResonator(methodName='runTest')[source]

Bases: TestCase

Unit tests for the Resonator class which works as a container for aperture and geometry.

setUp()[source]

Creates a sample Resonator instance using a cuboid geometry and tube aperture.

test_from_dict_reconstruction()[source]

Tests whether a Resonator can be correctly restructured from its representation in the dictionary.

test_initialization()[source]

Tests if Resonator initializes correctly with given Geometry and Aperture instances.

test_to_dict_structure_and_values()[source]

Tests whether to_dict() returns a dictionary with the correct structure and expected values for form and radius of apperture.

tests.calculation.test_simulation_parameters

class tests.calculation.test_simulation_parameters.TestSimulationParameters(methodName='runTest')[source]

Bases: TestCase

Unit tests for the SimulationParameters class. These tests check the correctness of frequency calculation, physical relationships, and input validation via Traits.

setUp()[source]

Set up a default Medium and SimulationParameters instance for testing.

test_dependent_arrays()[source]

Test that the arrays omega, k, and wavelength are calculated correctly.

test_diffuse_sets_angle_zero()[source]

Test that setting assume_diffuse to True resets the angle of incidence to 0°. This mimics a uniformly distributed sound field.

test_freq_mon_increase()[source]

Test that the generated frequency vector is strictly increasing. Ensures that no invalid or unordered values exist.

test_freq_range_too_low_trait_error()[source]

Test that defining a frequency range with a minimum below 0.01 Hz raises a TraitError. The lower bound for freq_range is set to 1.0 Hz in the class definition.

test_frequency_vector_length()[source]

Test that the number of calculated frequencies matches: number of octaves × values_per_octave. Ensures correct log spacing and resolution.

test_values_per_octave_float_raises()[source]

Test that assigning a float to values_per_octave raises a TraitError. Only integer values are allowed by the Trait definition.

test_zero_values_per_octave_raises()[source]

Test zero values_per_octave raises a TraitError.