def test_fractional_hours(self, mock_set):
     cell_method = CellMethod('sum', 'time', '25.9 hours')
     with mock.patch('warnings.warn') as warn:
         set_time_increment(cell_method, mock.sentinel.grib)
     warn.assert_called_once_with('Truncating floating point timeIncrement '
                                  '25.9 to integer value 25')
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 1)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 25)
 def test_fractional_hours(self, mock_set):
     cell_method = CellMethod('sum', 'time', '25.9 hours')
     with mock.patch('warnings.warn') as warn:
         set_time_increment(cell_method, mock.sentinel.grib)
     warn.assert_called_once_with('Truncating floating point timeIncrement '
                                  '25.9 to integer value 25')
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 1)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 25)
 def test_hours(self, mock_set):
     cell_method = CellMethod('sum', 'time', '25 hours')
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 1)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 25)
 def test_multiple_intervals(self, mock_set):
     cell_method = CellMethod('sum', 'time', ('1 hour', '24 hour'))
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 255)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 0)
 def test_area(self, mock_set):
     cell_method = CellMethod('sum', 'area', '25 km')
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 255)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 0)
 def test_hours(self, mock_set):
     cell_method = CellMethod('sum', 'time', '25 hours')
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 1)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 25)
 def test_multiple_intervals(self, mock_set):
     cell_method = CellMethod('sum', 'time', ('1 hour', '24 hour'))
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 255)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 0)
 def test_area(self, mock_set):
     cell_method = CellMethod('sum', 'area', '25 km')
     set_time_increment(cell_method, mock.sentinel.grib)
     mock_set.assert_any_call(mock.sentinel.grib,
                              'indicatorOfUnitForTimeIncrement', 255)
     mock_set.assert_any_call(mock.sentinel.grib, 'timeIncrement', 0)