@patch.object(R, '_categorize')
    def test_metric_with_expiration(self, mock_categorize):

        slug = 'categorized-metric'
        n = 1

        # get the keys used for the metric, so we can check for calls
        keys = self.r._build_keys(slug)
        self.r.metric(slug, num=n, expire=3600)

        # Verify that setting a metric adds the appropriate slugs to the keys
        # set and then incrememts each key
        call_list = [call.sadd(self.r._metric_slugs_key, slug), call.pipeline()]
        for k in keys:
            call_list.append(call.pipeline().incr(k, n))
            call_list.append(call.pipeline().expire(k, 3600))

        self.redis.assert_has_calls(call_list)

        # Make sure nothing was categorized.
        self.assertFalse(mock_categorize.called)
The ``metric`` method should call the redis ``expire`` method if
dataset/ETHPy150Open bradmontgomery/django-redis-metrics/redis_metrics/tests/test_models.py/TestR.test_metric_with_expiration