コード例 #1
0
    def test_map_axis_no_dimension(self, target):
        axis = mock.MagicMock()
        axis.isTime.return_value = False

        preprocess.map_axis(axis, None, 'days since 2020')

        target.assert_called()
コード例 #2
0
    def test_map_axis_unknown_crs(self, target):
        axis = mock.MagicMock()
        axis.isTime.return_value = False

        dimension = cwt.Dimension('time', 0, 365, cwt.CRS('test'))

        with self.assertRaises(WPSError):
            preprocess.map_axis(axis, dimension, 'days since 2020')
コード例 #3
0
    def test_map_axis_indices(self, target):
        axis = mock.MagicMock()
        axis.isTime.return_value = False

        dimension = cwt.Dimension('time', 0, 365, cwt.INDICES)

        preprocess.map_axis(axis, dimension, 'days since 2020')

        target.assert_called()
コード例 #4
0
    def test_map_axis_time_axis_no_units(self):
        axis = mock.MagicMock()
        axis.isTime.return_value = True

        dimension = cwt.Dimension('time', 0, 365, cwt.TIMESTAMPS)

        preprocess.map_axis(axis, dimension, None)

        axis.clone.assert_not_called()
コード例 #5
0
    def test_map_axis_time_axis(self):
        axis = mock.MagicMock()
        axis.isTime.return_value = True

        dimension = cwt.Dimension('time', 0, 365, cwt.TIMESTAMPS)

        preprocess.map_axis(axis, dimension, 'days since 2020')

        axis.clone.assert_called()

        axis.clone.return_value.toRelativeTime.assert_called_with(
            'days since 2020')