mcstasscript.tests.test_geometry_viewer.TestPyThreejsCustomOpacities

Contents

mcstasscript.tests.test_geometry_viewer.TestPyThreejsCustomOpacities#

class mcstasscript.tests.test_geometry_viewer.TestPyThreejsCustomOpacities(methodName='runTest')#

Tests for PyThreejsRenderer custom component opacities feature.

__init__(methodName='runTest')#

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.

Methods

__init__([methodName])

Create an instance of the class that will use the named test method when executed.

addClassCleanup(function, /, *args, **kwargs)

Same as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).

addCleanup(function, /, *args, **kwargs)

Add a function, with arguments, to be called when the test is completed.

addTypeEqualityFunc(typeobj, function)

Add a type specific assertEqual style function to compare a type.

assertAlmostEqual(first, second[, places, ...])

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta.

assertAlmostEquals(**kwargs)

assertCountEqual(first, second[, msg])

Asserts that two iterables have the same elements, the same number of times, without regard to order.

assertDictContainsSubset(subset, dictionary)

Checks whether dictionary is a superset of subset.

assertDictEqual(d1, d2[, msg])

assertEqual(first, second[, msg])

Fail if the two objects are unequal as determined by the '==' operator.

assertEquals(**kwargs)

assertFalse(expr[, msg])

Check that the expression is false.

assertGreater(a, b[, msg])

Just like self.assertTrue(a > b), but with a nicer default message.

assertGreaterEqual(a, b[, msg])

Just like self.assertTrue(a >= b), but with a nicer default message.

assertIn(member, container[, msg])

Just like self.assertTrue(a in b), but with a nicer default message.

assertIs(expr1, expr2[, msg])

Just like self.assertTrue(a is b), but with a nicer default message.

assertIsInstance(obj, cls[, msg])

Same as self.assertTrue(isinstance(obj, cls)), with a nicer default message.

assertIsNone(obj[, msg])

Same as self.assertTrue(obj is None), with a nicer default message.

assertIsNot(expr1, expr2[, msg])

Just like self.assertTrue(a is not b), but with a nicer default message.

assertIsNotNone(obj[, msg])

Included for symmetry with assertIsNone.

assertLess(a, b[, msg])

Just like self.assertTrue(a < b), but with a nicer default message.

assertLessEqual(a, b[, msg])

Just like self.assertTrue(a <= b), but with a nicer default message.

assertListEqual(list1, list2[, msg])

A list-specific equality assertion.

assertLogs([logger, level])

Fail unless a log message of level level or higher is emitted on logger_name or its children.

assertMultiLineEqual(first, second[, msg])

Assert that two multi-line strings are equal.

assertNoLogs([logger, level])

Fail unless no log messages of level level or higher are emitted on logger_name or its children.

assertNotAlmostEqual(first, second[, ...])

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta.

assertNotAlmostEquals(**kwargs)

assertNotEqual(first, second[, msg])

Fail if the two objects are equal as determined by the '!=' operator.

assertNotEquals(**kwargs)

assertNotIn(member, container[, msg])

Just like self.assertTrue(a not in b), but with a nicer default message.

assertNotIsInstance(obj, cls[, msg])

Included for symmetry with assertIsInstance.

assertNotRegex(text, unexpected_regex[, msg])

Fail the test if the text matches the regular expression.

assertNotRegexpMatches(**kwargs)

assertRaises(expected_exception, *args, **kwargs)

Fail unless an exception of class expected_exception is raised by the callable when invoked with specified positional and keyword arguments.

assertRaisesRegex(expected_exception, ...)

Asserts that the message in a raised exception matches a regex.

assertRaisesRegexp(**kwargs)

assertRegex(text, expected_regex[, msg])

Fail the test unless the text matches the regular expression.

assertRegexpMatches(**kwargs)

assertSequenceEqual(seq1, seq2[, msg, seq_type])

An equality assertion for ordered sequences (like lists and tuples).

assertSetEqual(set1, set2[, msg])

A set-specific equality assertion.

assertTrue(expr[, msg])

Check that the expression is true.

assertTupleEqual(tuple1, tuple2[, msg])

A tuple-specific equality assertion.

assertWarns(expected_warning, *args, **kwargs)

Fail unless a warning of class warnClass is triggered by the callable when invoked with specified positional and keyword arguments.

assertWarnsRegex(expected_warning, ...)

Asserts that the message in a triggered warning matches a regexp.

assert_(**kwargs)

countTestCases()

debug()

Run the test without collecting errors in a TestResult

defaultTestResult()

doClassCleanups()

Execute all class cleanup functions.

doCleanups()

Execute all cleanup functions.

enterClassContext(cm)

Same as enterContext, but class-wide.

enterContext(cm)

Enters the supplied context manager.

fail([msg])

Fail immediately, with the given message.

failIf(**kwargs)

failIfAlmostEqual(**kwargs)

failIfEqual(**kwargs)

failUnless(**kwargs)

failUnlessAlmostEqual(**kwargs)

failUnlessEqual(**kwargs)

failUnlessRaises(**kwargs)

id()

run([result])

setUp()

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

setUpClass()

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

shortDescription()

Returns a one-line description of the test, or None if no description has been provided.

skipTest(reason)

Skip this test.

subTest([msg])

Return a context manager that will return the enclosed block of code in a subtest identified by the optional message and keyword parameters.

tearDown()

Hook method for deconstructing the test fixture after testing it.

tearDownClass()

Hook method for deconstructing the class fixture after running all tests in the class.

test_apply_custom_opacities()

_apply_custom_opacities applies opacities to registered components.

test_apply_custom_opacities_empty_map()

_apply_custom_opacities with empty map is a no-op.

test_apply_custom_opacities_partial_match()

Mapped components get custom opacity; unmapped keep their existing opacity.

test_both_color_and_opacity_together()

Custom colors and opacities can be active simultaneously.

test_checkbox_off_restores_base_opacity()

Unchecking restores all components to base opacity.

test_checkbox_on_only_changes_mapped_components()

Checking with a single-component map only changes that one component.

test_checkbox_toggle_off()

Unchecking the checkbox resets to base opacities.

test_checkbox_toggle_on()

Checking the checkbox applies custom opacities.

test_colormode_change_preserves_custom_opacities()

Colormode change keeps checkbox checked; mapped components retain custom opacity.

test_create_custom_opacities_checkbox_with_map()

create_custom_opacities_checkbox returns a Checkbox when map is provided.

test_create_custom_opacities_checkbox_without_map()

create_custom_opacities_checkbox returns None when no map provided.

test_cylinder_shape_specific_opacity()

Cylinder opacity is size-based and correctly captured.

test_empty_component_opacity_no_checkbox()

Empty dict for component_opacity should not create a checkbox.

test_grey_all_preserves_custom_opacities()

_grey_all_components greys unmapped but preserves mapped custom opacities.

test_init_converts_int_to_float()

Integer opacity values should be converted to float.

test_init_validates_non_numeric_value()

Non-numeric opacity values should raise TypeError.

test_init_validates_out_of_range_value()

Opacity values outside [0.0, 1.0] should raise ValueError.

test_init_with_component_opacity()

Renderer with component_opacity should store the mapping.

test_init_without_component_opacity()

Renderer without component_opacity should have empty map.

test_intensity_refresh_preserves_custom_opacities()

Intensity data refresh keeps mapped components at custom opacity.

test_opacity_independent_of_colors()

Custom opacity checkbox is independent from custom colors checkbox.

test_opacity_preserves_color()

Applying custom opacity must not change the component's color.

test_original_opacity_captured_at_render()

Original opacity is captured from rendered mesh at render time.

test_reset_restores_each_shape_opacity()

A component with mixed shapes restores every base opacity.

test_reset_restores_shape_specific_opacity()

Reset restores the shape-specific opacity (e.g., 0.8 for box).

test_reset_to_base_opacities()

_reset_to_base_opacities restores original opacities.

test_update_component_opacity_sets_material()

update_component_opacity sets material.opacity and material.transparent.

Attributes

longMessage

maxDiff

test_apply_custom_opacities()#

_apply_custom_opacities applies opacities to registered components.

test_apply_custom_opacities_empty_map()#

_apply_custom_opacities with empty map is a no-op.

test_apply_custom_opacities_partial_match()#

Mapped components get custom opacity; unmapped keep their existing opacity.

test_both_color_and_opacity_together()#

Custom colors and opacities can be active simultaneously.

test_checkbox_off_restores_base_opacity()#

Unchecking restores all components to base opacity.

test_checkbox_on_only_changes_mapped_components()#

Checking with a single-component map only changes that one component.

test_checkbox_toggle_off()#

Unchecking the checkbox resets to base opacities.

test_checkbox_toggle_on()#

Checking the checkbox applies custom opacities.

test_colormode_change_preserves_custom_opacities()#

Colormode change keeps checkbox checked; mapped components retain custom opacity.

test_create_custom_opacities_checkbox_with_map()#

create_custom_opacities_checkbox returns a Checkbox when map is provided.

test_create_custom_opacities_checkbox_without_map()#

create_custom_opacities_checkbox returns None when no map provided.

test_cylinder_shape_specific_opacity()#

Cylinder opacity is size-based and correctly captured.

test_empty_component_opacity_no_checkbox()#

Empty dict for component_opacity should not create a checkbox.

test_grey_all_preserves_custom_opacities()#

_grey_all_components greys unmapped but preserves mapped custom opacities.

test_init_converts_int_to_float()#

Integer opacity values should be converted to float.

test_init_validates_non_numeric_value()#

Non-numeric opacity values should raise TypeError.

test_init_validates_out_of_range_value()#

Opacity values outside [0.0, 1.0] should raise ValueError.

test_init_with_component_opacity()#

Renderer with component_opacity should store the mapping.

test_init_without_component_opacity()#

Renderer without component_opacity should have empty map.

test_intensity_refresh_preserves_custom_opacities()#

Intensity data refresh keeps mapped components at custom opacity.

test_opacity_independent_of_colors()#

Custom opacity checkbox is independent from custom colors checkbox.

test_opacity_preserves_color()#

Applying custom opacity must not change the component’s color.

test_original_opacity_captured_at_render()#

Original opacity is captured from rendered mesh at render time.

test_reset_restores_each_shape_opacity()#

A component with mixed shapes restores every base opacity.

test_reset_restores_shape_specific_opacity()#

Reset restores the shape-specific opacity (e.g., 0.8 for box).

test_reset_to_base_opacities()#

_reset_to_base_opacities restores original opacities.

test_update_component_opacity_sets_material()#

update_component_opacity sets material.opacity and material.transparent.