Skip to content

Tally segment parsing bug fix. #241

Tally segment parsing bug fix.

Tally segment parsing bug fix. #241

GitHub Actions / CI-test-report failed Jun 17, 2024 in 0s

CI-test-report ❌

Tests failed

❌ test_report.xml

390 tests were completed in 7s with 388 passed, 2 failed and 0 skipped.

Test suite Passed Failed Skipped Time
pytest 388✅ 2❌ 7s

❌ pytest

tests.test_cell_problem.TestCellClass
  ✅ test_bad_init
  ✅ test_cell_density_deleter
  ✅ test_cell_density_setter
  ✅ test_cell_parameters_setting
  ✅ test_cell_paremeters_no_eq
  ✅ test_cell_sorting
  ✅ test_cell_str
  ✅ test_cell_validator
  ✅ test_init
  ✅ test_number_setter
tests.test_data_inputs.testDataInputClass
  ✅ test_comment_setter
  ✅ test_data_card_empty_constructor
  ✅ test_data_card_format_mcnp
  ✅ test_data_card_init
  ✅ test_data_card_mutate_print
  ✅ test_data_card_str
  ✅ test_data_parser
  ✅ test_print_in_data_block
  ✅ test_volume_deleter
  ✅ test_volume_init_cell
  ✅ test_volume_init_data
  ✅ test_volume_merge
  ✅ test_volume_repr
  ✅ test_volume_setter
  ✅ test_volumes_for_only_some_cells
tests.test_data_inputs.TestClassifier
  ✅ test_classifier_start_comment
tests.test_edge_cases.EdgeCaseTests
  ✅ test_bad_read
  ✅ test_complement_edge_case
  ✅ test_confused_key_word
  ✅ test_confused_trcl
  ✅ test_confused_union_geometry
  ✅ test_excess_mt
  ✅ test_geometry_comments
  ✅ test_interp_surface_edge_case
  ✅ test_interpolate_geometry
  ✅ test_long_lines
  ✅ test_material_float
  ✅ test_missing_mat_for_mt
  ✅ test_orphaning_mt
  ✅ test_shortcuts_in_special_comment
  ✅ test_space_after_equals
  ✅ test_surface_edge_case
  ✅ test_void_cell_set_material
tests.test_geometry.TestHalfSpaceUnit
  ✅ test_eq
  ✅ test_get_leaves
  ✅ test_init
  ✅ test_len
  ✅ test_str
tests.test_geometry.TestUnitHalfSpaceUnit
  ✅ test_eq
  ✅ test_init
  ✅ test_str
tests.test_geometry.TestGeometryIntegration
  ✅ test_cell_half_space
  ✅ test_iand_recursion
  ✅ test_intersect_half_space
  ✅ test_invert_half_space
  ✅ test_ior_recursion
  ✅ test_parse_input_tree
  ✅ test_parse_input_value_node
  ✅ test_surface_half_space
  ✅ test_tree_create_default_node
  ✅ test_union_half_space
  ✅ test_unit_create_default_node
  ✅ test_unit_divider_setter
  ✅ test_update_operators_in_node
  ✅ test_update_tree_with_comment
tests.test_importance.TestImportance
  ✅ test_importance_all_setter
  ✅ test_importance_deleter
  ✅ test_importance_init_cell
  ✅ test_importance_init_data
  ✅ test_importance_iter_getter_in
  ✅ test_importance_merge
  ✅ test_importance_setter
  ✅ tests_redundant_importance
tests.test_input_file.testInputFileWrapper
  ✅ test_init
  ✅ test_open_iter
  ✅ test_read
  ✅ test_readline
  ✅ test_str
  ✅ test_write
tests.test_integration.testFullFileIntegration
  ✅ test_alternate_encoding
  ✅ test_avoid_blank_cell_modifier_write
  ✅ test_cell_card_pass_through
  ✅ test_cell_complement_broken_link
  ✅ test_cell_material_setter
  ✅ test_cell_multi_volume
  ✅ test_cell_not_truncate_setter
  ✅ test_cell_surf_broken_link
  ✅ test_cell_validator
  ✅ test_cells_parsing_linking
  ✅ test_check_volume_calculated
  ✅ test_comments_setter
  ✅ test_cutting_comments_parse
  ✅ test_cutting_comments_print_mutate
  ✅ test_cutting_comments_print_no_mutate
  ✅ test_data_card_parsing
  ✅ test_data_print_control_str
  ✅ test_delete_vol
  ✅ test_enable_mcnp_vol_calc
  ✅ test_expansion_warning_crash
  ✅ test_fill_cell_format
  ✅ test_fill_parsing
  ✅ test_fill_transform_setter
  ✅ test_importance_end_repeat
  ✅ test_importance_format_mutated
  ✅ test_importance_format_unmutated
  ✅ test_importance_parsing
  ✅ test_importance_rewrite
  ✅ test_importance_write_cell
  ✅ test_importance_write_data
  ✅ test_importance_write_mutated
  ✅ test_importance_write_unmutated
  ✅ test_lattice_format_data
  ✅ test_lattice_push_to_cells
  ✅ test_lazy_comments_check
  ✅ test_leading_comments
  ✅ test_material_broken_link
  ✅ test_material_parsing
  ✅ test_materials_setter
  ✅ test_message
  ✅ test_original_input
  ✅ test_original_input_dos
  ✅ test_original_input_tabs
  ✅ test_parsing_error
  ✅ test_problem_cells_setter
  ✅ test_problem_children_adder
  ✅ test_problem_duplicate_surface_remover
  ✅ test_problem_linker
  ✅ test_problem_mcnp_version_setter
  ✅ test_problem_str
  ✅ test_problem_test_setter
  ✅ test_read_card_recursion
  ✅ test_redundant_volume
  ✅ test_reverse_pointers
  ✅ test_set_equal_importance
  ✅ test_set_mode
  ✅ test_surface_broken_link
  ✅ test_surface_card_pass_through
  ✅ test_surface_parsing
  ✅ test_surface_periodic
  ✅ test_surface_transform
  ✅ test_thermal_scattering_pass_through
  ✅ test_title
  ✅ test_universe_cell_formatter
  ✅ test_universe_cell_parsing
  ✅ test_universe_cells
  ✅ test_universe_cells_claim
  ✅ test_universe_data_formatter
  ✅ test_universe_fill_data_parsing
  ✅ test_universe_number_collision
  ✅ test_universe_problem_parsing
  ✅ test_universe_repr
  ✅ test_universe_setter
  ✅ test_wrap_warning
  ✅ test_write_to_file
tests.test_interface.TestBrinyFermentation
  ✅ test_pickling_all_models
tests.test_main.TestMainRunner
  ✅ test_argument_parsing
  ✅ test_check_no_error
  ✅ test_check_warning
tests.test_material.testMaterialClass
  ✅ test_material_card_pass_through
  ✅ test_material_comp_fraction_setter
  ✅ test_material_comp_fraction_str
  ✅ test_material_comp_init
  ✅ test_material_format_mcnp
  ✅ test_material_init
  ✅ test_material_parameter_parsing
  ✅ test_material_setter
  ✅ test_material_sort
  ✅ test_material_str
  ✅ test_material_validator
tests.test_material.TestIsotope
  ✅ test_isotope_get_base_zaid
  ✅ test_isotope_init
  ✅ test_isotope_library_setter
  ✅ test_isotope_metastable_init
  ✅ test_isotope_str
tests.test_material.TestThermalScattering
  ✅ test_thermal_scatter_validate
  ✅ test_thermal_scattering_add
  ✅ test_thermal_scattering_format_mcnp
  ✅ test_thermal_scattering_init
  ✅ test_thermal_scattering_material_add
  ✅ test_thermal_scattering_particle_parser
  ✅ test_thermal_scattering_setter
  ✅ test_thermal_str
tests.test_material.TestElement
  ✅ test_element_init
  ✅ test_element_str
  ✅ test_get_by_name
  ✅ test_get_by_symbol
tests.test_material.TestParticle
  ✅ test_particle_str
tests.test_mcnp_problem.testMCNP_problem
  ✅ test_problem_init
  ✅ test_problem_str
tests.test_mode.TestMode
  ✅ test_mode_add
  ✅ test_mode_format_input
  ✅ test_mode_init
  ✅ test_mode_iter
  ✅ test_mode_remove
  ✅ test_set_mode
tests.test_numbered_collection.TestNumberedObjectCollection
  ✅ test_append
  ✅ test_append_renumber
  ✅ test_bad_init
  ✅ test_check_number
  ✅ test_delete
  ✅ test_extend
  ✅ test_get
  ✅ test_getitem
  ✅ test_iadd
  ✅ test_items
  ✅ test_iter
  ✅ test_keys
  ✅ test_next_number
  ✅ test_number_adding_concurancy
  ✅ test_number_conflict_init
  ✅ test_numbers
  ✅ test_objects
  ✅ test_pop
  ✅ test_request_number
  ✅ test_setitem
  ✅ test_slice
  ✅ test_str
  ✅ test_surface_generators
  ✅ test_values
tests.test_scripts.TestChangeAsciiScript
  ✅ test_bad_arguments
  ✅ test_delete_bad
  ✅ test_whitespace_bad
tests.test_source_def.TestSourceDefinition
  ✅ test_complex_sdef_parser
tests.test_surfaces.testSurfaces
  ✅ test_axis_plane_init
  ✅ test_axis_plane_location_setter
  ✅ test_cylinder_axis_radius_setter
  ✅ test_cylinder_location_setter
  ✅ test_cylinder_on_axis_init
  ✅ test_cylinder_par_axis_init
  ✅ test_cylinder_radius_setter
  ✅ test_gen_plane_init
  ✅ test_surface_builder
  ✅ test_surface_constants_setter
  ✅ test_surface_format_for_mcnp
  ✅ test_surface_init
  ✅ test_surface_is_reflecting_setter
  ✅ test_surface_is_white_bound_setter
  ✅ test_surface_number_setter
  ✅ test_surface_ordering
  ✅ test_surface_str
  ✅ test_validator
tests.test_syntax_parsing.TestValueNode
  ✅ test_is_negat_float
  ✅ test_is_negat_identifier
  ✅ test_is_negative
  ✅ test_value_comments
  ✅ test_value_enum_format
  ✅ test_value_equality
  ✅ test_value_float_format
  ✅ test_value_has_changed
  ✅ test_value_str
  ✅ test_value_str_format
  ✅ test_value_trailing_comments
  ✅ test_valuenode_convert_to_enum
  ✅ test_valuenode_convert_to_int
  ✅ test_valuenode_int_format
  ✅ test_valuenoode_init
tests.test_syntax_parsing.TestSyntaxNode
  ✅ test_get_value
  ✅ test_syntax_comments
  ✅ test_syntax_dict
  ✅ test_syntax_format
  ✅ test_syntax_init
  ✅ test_syntax_name
  ✅ test_syntax_str
  ✅ test_syntax_trailing_comments
tests.test_syntax_parsing.TestGeometryTree
  ✅ test_geometry_comments
  ✅ test_geometry_format
  ✅ test_geometry_init
  ✅ test_geometry_str
tests.test_syntax_parsing.TestPaddingNode
  ✅ test_blank_dollar_comment
  ✅ test_comment_append
  ✅ test_comment_init
  ✅ test_comment_str
  ✅ test_padding_append
  ✅ test_padding_eq
  ✅ test_padding_format
  ✅ test_padding_grab_beginning_format
  ✅ test_padding_init
  ✅ test_padding_is_space
tests.test_syntax_parsing.TestParticlesNode
  ✅ test_particle_init
  ✅ test_particles_add_remove
  ✅ test_particles_format
  ✅ test_particles_setter
  ✅ test_particles_sorted
tests.test_syntax_parsing.TestListNode
  ✅ test_list_append
  ✅ test_list_comments
  ✅ test_list_equality
  ✅ test_list_format
  ✅ test_list_init
  ✅ test_list_slicing
  ✅ test_list_str
  ✅ test_list_trailing_comment
tests.test_syntax_parsing.TestIsotopesNode
  ✅ test_isotopes_append
  ✅ test_isotopes_comments
  ✅ test_isotopes_format
  ✅ test_isotopes_init
  ✅ test_isotopes_iter
  ✅ test_isotopes_str
  ✅ test_isotopes_trailing_comment
tests.test_syntax_parsing.TestShortcutNode
  ✅ test_basic_shortcut_init
  ✅ test_shortcut_end_padding_setter
  ✅ test_shortcut_expansion
  ✅ test_shortcut_format
  ✅ test_shortcut_geometry_expansion
tests.test_syntax_parsing.TestShortcutListIntegration
  ✅ test_shortcut_list_interpolate
  ✅ test_shortcut_list_multiply
  ✅ test_shortcut_list_node_init
  ✅ test_shortcut_list_shortcut_cant_consume
  ✅ test_shortcut_list_touching_shortcuts
  ✅ test_shortcut_list_trailing_jump
  ✅ test_shortcut_list_update_vals
  ✅ test_shortcut_list_update_vals_repeat
  ✅ test_shortcut_then_jump_compress
tests.test_syntax_parsing.TestSyntaxParsing
  ✅ testBlockId
  ✅ testCardFinder
  ✅ testCardInit
  ✅ testCardStringRepr
  ✅ testCommentFormatInput
  ✅ testDataInputNameEnforcement
  ✅ testDataInputNameParsing
  ✅ testMessageFinder
  ✅ testMessageFormatInput
  ✅ testMessageInit
  ✅ testReadCardBadSyntax
  ✅ testReadCardConfusions
  ✅ testReadCardFinder
  ✅ testReadCardStr
  ✅ testReadInput
  ✅ testReadInputWithRead
  ✅ testReadInputWithVertMode
  ✅ testSingleLineEndComment
  ✅ testTitleFinder
  ✅ testTitleFormatInput
  ✅ testTitleInit
  ✅ test_get_line_numbers
  ✅ test_jump
  ✅ test_jump_and_a_hop
tests.test_syntax_parsing.TestClassifierNode
  ✅ test_classifier_comments
  ✅ test_classifier_format
  ✅ test_classifier_init
  ✅ test_classifier_setter
tests.test_syntax_parsing.TestParametersNode
  ✅ test_parameter_append
  ✅ test_parameter_comments
  ✅ test_parameter_dict
  ✅ test_parameter_format
  ✅ test_parameter_init
  ✅ test_parameter_str
  ✅ test_parameter_trailing_comments
tests.test_tally.TestTallyParser
  ✅ test_parsing_tally_groups
  ✅ test_parsing_tally_multiplier
  ✅ test_parsing_tally_print
tests.test_tally
  ✅ test_tally_segment_init[fs14 -123]
  ✅ test_tally_segment_init[fs12 -456 t]
  ✅ test_tally_segment_init[fs11 -1 -2]
  ❌ test_tally_segment_init[fs16 +1 +2 c]
	line = 'fs16 +1 +2 c'
  ❌ test_tally_segment_init[fs17 -1 -2 t c]
	line = 'fs17 -1 -2 t c'
tests.test_transform.testTransformClass
  ✅ test_is_main_aux_setter
  ✅ test_tranform_rotation_setter
  ✅ test_transform_degrees_setter
  ✅ test_transform_displace_setter
  ✅ test_transform_equivalent
  ✅ test_transform_init
  ✅ test_transform_number_setter
  ✅ test_transform_print_mcnp
  ✅ test_transform_str
  ✅ test_transform_update_values
  ✅ test_validate
tests.test_universe.TestUniverseInput
  ✅ test_merge
  ✅ test_str
  ✅ test_universe_card_init
  ✅ test_universe_setter
  ✅ test_universe_truncate_setter
tests.test_universe.TestUniverse
  ✅ test_init
  ✅ test_number_setter
tests.test_universe.TestLattice
  ✅ test_lattice_cell_format
  ✅ test_lattice_deleter
  ✅ test_lattice_init
  ✅ test_lattice_merge
  ✅ test_lattice_repr
  ✅ test_lattice_setter
tests.test_universe.TestFill
  ✅ test_complex_transform_fill_init
  ✅ test_complicated_lattice_fill_init
  ✅ test_data_fill_init
  ✅ test_fill_merge
  ✅ test_fill_str
  ✅ test_fill_universe_setter
  ✅ test_fill_universes_setter
tests.test_utilities.testFortranFloat
  ✅ test_normal_float_parse
  ✅ test_raise_error
  ✅ test_stupid_float_parse
tests.test_version.TestVersion
  ✅ test_version

Annotations

Check failure on line 0 in test_report.xml

See this annotation in the file changed.

@github-actions github-actions / CI-test-report

pytest ► tests.test_tally ► test_tally_segment_init[fs16 +1 +2 c]

Failed test found in:
  test_report.xml
Error:
  line = 'fs16 +1 +2 c'
Raw output
line = 'fs16 +1 +2 c'

    @pytest.mark.parametrize(
        "line",
        [
            "fs14 -123",
            "fs12 -456 t",
            "fs11 -1 -2",
            "fs16 +1 +2 c",
            "fs17 -1 -2 t c",
        ],
    )
    def test_tally_segment_init(line):
        input = Input([line], BlockType.DATA)
>       data = parse_data(input)

tests/test_tally.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
montepy/data_inputs/data_parser.py:53: in parse_data
    return data_class(input)
montepy/data_inputs/data_input.py:54: in __init__
    super().__init__(input, self._parser)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <montepy.data_inputs.tally_segment.TallySegment object at 0x7fe1e5607070>
input = INPUT: BlockType.DATA: ['fs16 +1 +2 c']
parser = <montepy.input_parser.tally_parser.TallyParser object at 0x7fe1e5ec8cd0>

    def __init__(self, input, parser):
        self._problem = None
        self._parameters = ParametersNode()
        self._input = None
        if input:
            if not isinstance(input, montepy.input_parser.mcnp_input.Input):
                raise TypeError("input must be an Input")
            try:
                try:
                    parser.restart()
                # raised if restarted without ever parsing
                except AttributeError as e:
                    pass
                self._tree = parser.parse(input.tokenize(), input)
                self._input = input
            except ValueError as e:
                raise MalformedInputError(
                    input, f"Error parsing object of type: {type(self)}: {e.args[0]}"
                )
            if self._tree is None:
>               raise ParsingError(
                    input,
                    "",
                    parser.log.clear_queue(),
                )
E               montepy.errors.ParsingError:     , line 0
E               
E                   >    0| fs16 +1 +2 c
E                         |            ^ not expected here.
E               There was an error parsing "c".
E               sly: Syntax error at line 1, token=TEXT

montepy/mcnp_object.py:57: ParsingError

Check failure on line 0 in test_report.xml

See this annotation in the file changed.

@github-actions github-actions / CI-test-report

pytest ► tests.test_tally ► test_tally_segment_init[fs17 -1 -2 t c]

Failed test found in:
  test_report.xml
Error:
  line = 'fs17 -1 -2 t c'
Raw output
line = 'fs17 -1 -2 t c'

    @pytest.mark.parametrize(
        "line",
        [
            "fs14 -123",
            "fs12 -456 t",
            "fs11 -1 -2",
            "fs16 +1 +2 c",
            "fs17 -1 -2 t c",
        ],
    )
    def test_tally_segment_init(line):
        input = Input([line], BlockType.DATA)
>       data = parse_data(input)

tests/test_tally.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
montepy/data_inputs/data_parser.py:53: in parse_data
    return data_class(input)
montepy/data_inputs/data_input.py:54: in __init__
    super().__init__(input, self._parser)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <montepy.data_inputs.tally_segment.TallySegment object at 0x7fe1e4e98f70>
input = INPUT: BlockType.DATA: ['fs17 -1 -2 t c']
parser = <montepy.input_parser.tally_parser.TallyParser object at 0x7fe1e5ec8cd0>

    def __init__(self, input, parser):
        self._problem = None
        self._parameters = ParametersNode()
        self._input = None
        if input:
            if not isinstance(input, montepy.input_parser.mcnp_input.Input):
                raise TypeError("input must be an Input")
            try:
                try:
                    parser.restart()
                # raised if restarted without ever parsing
                except AttributeError as e:
                    pass
                self._tree = parser.parse(input.tokenize(), input)
                self._input = input
            except ValueError as e:
                raise MalformedInputError(
                    input, f"Error parsing object of type: {type(self)}: {e.args[0]}"
                )
            if self._tree is None:
>               raise ParsingError(
                    input,
                    "",
                    parser.log.clear_queue(),
                )
E               montepy.errors.ParsingError:     , line 0
E               
E                   >    0| fs17 -1 -2 t c
E                         |              ^ not expected here.
E               There was an error parsing "c".
E               sly: Syntax error at line 1, token=TEXT

montepy/mcnp_object.py:57: ParsingError