@@ -117,42 +117,42 @@ def test_get_equal_final_state_ids(
117117 assert equal_ids == expected
118118
119119
120- def test_normalize_state_ids_reaction ( jpsi2pksigma_reaction : ReactionInfo ):
121- reaction012 = jpsi2pksigma_reaction
122- reaction123 = normalize_state_ids ( reaction012 )
123- assert set ( reaction123 . initial_state ) == { 0 }
124- assert set (reaction123 .final_state ) == {1 , 2 , 3 }
125-
126- transitions123 = normalize_state_ids ( reaction012 . transitions )
127- for transition012 , transition123 in zip (
128- reaction012 . transitions , transitions123 , strict = True
129- ):
130- assert set ( transition123 . initial_states ) == { 0 }
131- assert set (transition123 .final_states ) == {1 , 2 , 3 }
132- assert set (transition123 .intermediate_states ) == {4 }
133-
134- topology123 = normalize_state_ids ( transition123 . topology )
135- assert topology123 . incoming_edge_ids == { 0 }
136- assert topology123 .outgoing_edge_ids == {1 , 2 , 3 }
137- assert topology123 .intermediate_edge_ids == {4 }
138-
139- for i in transition012 . states :
140- assert transition012 . states [ i ] == transition123 .states [ i + 1 ]
141-
142-
143- def test_normalize_state_ids_problem_set ():
144- stm = StateTransitionManager (
145- initial_state = [("J/psi(1S)" , [- 1 , + 1 ])],
146- final_state = ["K0" , "Sigma+" , "p~" ],
147- allowed_intermediate_particles = ["N(1700)" , "Sigma(1750)" ],
148- formalism = "helicity" ,
149- mass_conservation_factor = 0 ,
150- )
151- stm .set_allowed_interaction_types ([InteractionType .STRONG , InteractionType .EM ])
152- problem_sets = stm .create_problem_sets ()
153- some_problem_set = normalize_state_ids (problem_sets [3600.0 ][0 ])
154- assert set (some_problem_set .initial_facts .initial_states ) == {0 }
155- assert set (some_problem_set .initial_facts .final_states ) == {1 , 2 , 3 }
120+ def describe_normalize_state_ids ( ):
121+ def it_normalizes_a_reaction ( jpsi2pksigma_reaction : ReactionInfo ):
122+ reaction012 = jpsi2pksigma_reaction
123+ reaction123 = normalize_state_ids ( reaction012 )
124+ assert set (reaction123 .initial_state ) == {0 }
125+ assert set ( reaction123 . final_state ) == { 1 , 2 , 3 }
126+
127+ transitions123 = normalize_state_ids ( reaction012 . transitions )
128+ for transition012 , transition123 in zip (
129+ reaction012 . transitions , transitions123 , strict = True
130+ ):
131+ assert set (transition123 .initial_states ) == {0 }
132+ assert set (transition123 .final_states ) == {1 , 2 , 3 }
133+ assert set ( transition123 . intermediate_states ) == { 4 }
134+
135+ topology123 = normalize_state_ids ( transition123 . topology )
136+ assert topology123 .incoming_edge_ids == {0 }
137+ assert topology123 .outgoing_edge_ids == {1 , 2 , 3 }
138+ assert topology123 . intermediate_edge_ids == { 4 }
139+
140+ for i in transition012 .states :
141+ assert transition012 . states [ i ] == transition123 . states [ i + 1 ]
142+
143+ def it_normalizes_a_problem_set ():
144+ stm = StateTransitionManager (
145+ initial_state = [("J/psi(1S)" , [- 1 , + 1 ])],
146+ final_state = ["K0" , "Sigma+" , "p~" ],
147+ allowed_intermediate_particles = ["N(1700)" , "Sigma(1750)" ],
148+ formalism = "helicity" ,
149+ mass_conservation_factor = 0 ,
150+ )
151+ stm .set_allowed_interaction_types ([InteractionType .STRONG , InteractionType .EM ])
152+ problem_sets = stm .create_problem_sets ()
153+ some_problem_set = normalize_state_ids (problem_sets [3600.0 ][0 ])
154+ assert set (some_problem_set .initial_facts .initial_states ) == {0 }
155+ assert set (some_problem_set .initial_facts .final_states ) == {1 , 2 , 3 }
156156
157157
158158def test_permute_equal_final_states (
0 commit comments