예제 #1
0
 def test_option(self):
     callback = MagicMock()
     option = Option(callback, 'add')
     option.add()
     callback.assert_called()
     option()
     self.assertEqual(callback.call_count, 2)
예제 #2
0
 def _init_field_options(self, field_names: Iterable[str]):
     self._field_options = NamedObjects()
     modes = ['max', 'min', 'average', 'sum', 'variance']
     for name in field_names:
         statistic_mode_options = NamedObjects()
         for mode_name in modes:
             statistic_mode_options['statistic_with_' + mode_name] = Option(
                 partial(self._add_statistic_field, name, mode_name))
         statistic_mode_options['statistic_with_std_deviation'] = Option(
             partial(self._add_statistic_field, name, 'stdDeviation'))
         self._field_options[name] = statistic_mode_options
예제 #3
0
 def available_mesh_sieze_units(self):
     result = NamedObjects()
     for unit in [
             DistanceUnit.Meter, DistanceUnit.Kilometer, DistanceUnit.Yard,
             DistanceUnit.Foot, DistanceUnit.Mile
     ]:
         result[unit.name] = Option(
             partial(self._mesh_size_unit_selected, unit), 'select')
     return result
예제 #4
0
 def _init_region_dataset_options(self, region_dataset_names: List[str]):
     self._region_dataset_options = NamedObjects()
     for name in region_dataset_names:
         self._region_dataset_options[name] = Option(
             partial(self._dataset_selected, name), 'select')