Пример #1
0
 def test_segment_param_calculation(self):
     for crt_data in self.segment_data:
         for param_names in self.base_segment_params:
             crt_params = dict([x for x in crt_data.items() if x[0] in param_names])
             for name in Segment.calc_function_map:
                 segment = Segment(verify=False, **crt_params)
                 actual_value = getattr(segment, name)
                 if name in crt_data:
                     expected_value = Segment.wrap_param(name, crt_data[name])
                     self.assertTrue(
                         np.allclose(expected_value, actual_value),
                         msg="Wrong value for {}, expected: {}, found: {}".format(
                             name, expected_value, actual_value
                         )
                     )
Пример #2
0
 def test_segment_from_base_params(self):
     for crt_data in self.segment_data:
         for param_names in self.base_segment_params:
             crt_params = dict([x for x in crt_data.items() if x[0] in param_names])
             segment = Segment(verify=False, **crt_params)
             # print "******************************"
             # print "param_names: ", param_names
             # print "crt_params: ", crt_params
             # print "******************************"
             # print segment
             segment.verify()
             # print segment
             for name, expected_value in crt_data.items():
                 if hasattr(segment, name):
                     expected_value = Segment.wrap_param(name, expected_value)
                     actual_value = getattr(segment, name)
                     self.assertTrue(
                         np.allclose(expected_value, actual_value),
                         msg="Wrong value for {}, expected: {}, found: {}".format(
                             name, expected_value, actual_value
                         )
                     )