# Path: rmr/utils/datetime.py
# def get_date_range(
#     start_date: int = None,
#     end_date: int = NOW,
#     max_range: int = None,
# ):
#     """
#     Get date range
# 
#     :rtype: (datetime, datetime)
#     """
#     warnings.warn(
#         'get_date_range is deprecated and will be removed in rmr-django 2.0, '
#         'use rmr.forms.StartStopTime to validate request params',
#         category=DeprecationWarning,
#     )
#     max_range = max_range or None
#     if max_range and None in (start_date, end_date):
#         raise ValueError(
#             'Both start_date and end_date must be not None '
#             'when max_range used'
#         )
# 
#     if end_date is NOW:
#         end = timezone.now()
#     elif end_date is None:
#         end = None
#     else:
#         end = fromtimestamp(end_date)
# 
#     if start_date is None:
#         start = max_range and end - timedelta(seconds=max_range)
#         return start, end
#     else:
#         start = fromtimestamp(start_date)
# 
#     if max_range and (end - start).seconds > max_range:
#         raise ValueError('Date range exceeds max_range')
# 
#     return start, end
# 
# def fromtimestamp(timestamp):
#     if timestamp is None:
#         return None
#     return datetime.fromtimestamp(timestamp, tz=timezone.get_current_timezone())
# 
# Path: rmr/utils/test.py
# class Parametrized(type):
# 
#     def __new__(mcs, name, mro, attrs):
#         warnings.warn(
#             'Parametrized metaclass is deprecated and will be removed '
#             'in rmr-django 2.0, use unittest.TestCase.subTest instead',
#             category=RuntimeWarning, stacklevel=2,
#         )
# 
#         actual_attrs = {}
#         for method_name, method in attrs.items():
#             data_sets = getattr(method, '__data_sets__', None)
#             if not data_sets:
#                 actual_attrs[method_name] = method
#                 continue
#             for data_set in data_sets:
#                 test_name = '{}_{}'.format(method_name, data_set)
#                 actual_attrs[test_name] = (lambda m, ds: (
#                     lambda self: m(self, *ds.args, **ds.kwargs)
#                 ))(method, data_set)
#         return super().__new__(mcs, name, mro, actual_attrs)


from datetime import datetime, timedelta
from django.test.utils import override_settings
from rmr.utils.datetime import get_date_range, fromtimestamp
from rmr.utils.test import Parametrized
import django.test
        )
        for case, params in cases.items():
            with self.subTest(case=case):
                with self.assertRaises(ValueError):
                    get_date_range(
                        start_date=params['start_date'],
                        end_date=params['end_date'],
                        max_range=params['max_range'],
                    )

    def test_get_date_range_results(self):
        cases = dict(
            all_parameters_none=dict(
                start_date=None,
                end_date=None,
                max_range=None,
                expected_start_date=None,
                expected_end_date=None,
            ),
            start_date_end_date_not_none=dict(
                start_date=int(datetime(2077, 9, 23).timestamp()),
                end_date=None,
                max_range=None,
                expected_start_date=fromtimestamp(datetime(2077, 9, 23).timestamp()),
                expected_end_date=None,
            ),
            max_range_is_none=dict(
                start_date=int(datetime(2077, 9, 23).timestamp()),
                end_date=int(datetime(2241, 7, 25).timestamp()),
                max_range=None,

# Path: rmr/utils/datetime.py
# def get_date_range(
#     start_date: int = None,
#     end_date: int = NOW,
#     max_range: int = None,
# ):
#     """
#     Get date range
# 
#     :rtype: (datetime, datetime)
#     """
#     warnings.warn(
#         'get_date_range is deprecated and will be removed in rmr-django 2.0, '
#         'use rmr.forms.StartStopTime to validate request params',
#         category=DeprecationWarning,
#     )
#     max_range = max_range or None
#     if max_range and None in (start_date, end_date):
#         raise ValueError(
#             'Both start_date and end_date must be not None '
#             'when max_range used'
#         )
# 
#     if end_date is NOW:
#         end = timezone.now()
#     elif end_date is None:
#         end = None
#     else:
#         end = fromtimestamp(end_date)
# 
#     if start_date is None:
#         start = max_range and end - timedelta(seconds=max_range)
#         return start, end
#     else:
#         start = fromtimestamp(start_date)
# 
#     if max_range and (end - start).seconds > max_range:
#         raise ValueError('Date range exceeds max_range')
# 
#     return start, end
# 
# def fromtimestamp(timestamp):
#     if timestamp is None:
#         return None
#     return datetime.fromtimestamp(timestamp, tz=timezone.get_current_timezone())
# 
# Path: rmr/utils/test.py
# class Parametrized(type):
# 
#     def __new__(mcs, name, mro, attrs):
#         warnings.warn(
#             'Parametrized metaclass is deprecated and will be removed '
#             'in rmr-django 2.0, use unittest.TestCase.subTest instead',
#             category=RuntimeWarning, stacklevel=2,
#         )
# 
#         actual_attrs = {}
#         for method_name, method in attrs.items():
#             data_sets = getattr(method, '__data_sets__', None)
#             if not data_sets:
#                 actual_attrs[method_name] = method
#                 continue
#             for data_set in data_sets:
#                 test_name = '{}_{}'.format(method_name, data_set)
#                 actual_attrs[test_name] = (lambda m, ds: (
#                     lambda self: m(self, *ds.args, **ds.kwargs)
#                 ))(method, data_set)
#         return super().__new__(mcs, name, mro, actual_attrs)


# Path: tests/utils/test_datetime.py
from datetime import datetime, timedelta
from django.test.utils import override_settings
from rmr.utils.datetime import get_date_range, fromtimestamp
from rmr.utils.test import Parametrized
import django.test

        )
        for case, params in cases.items():
            with self.subTest(case=case):
                with self.assertRaises(ValueError):
                    get_date_range(
                        start_date=params['start_date'],
                        end_date=params['end_date'],
                        max_range=params['max_range'],
                    )

    def test_get_date_range_results(self):
        cases = dict(
            all_parameters_none=dict(
                start_date=None,
                end_date=None,
                max_range=None,
                expected_start_date=None,
                expected_end_date=None,
            ),
            start_date_end_date_not_none=dict(
                start_date=int(datetime(2077, 9, 23).timestamp()),
                end_date=None,
                max_range=None,
                expected_start_date=fromtimestamp(datetime(2077, 9, 23).timestamp()),
                expected_end_date=None,
            ),
            max_range_is_none=dict(
                start_date=int(datetime(2077, 9, 23).timestamp()),
                end_date=int(datetime(2241, 7, 25).timestamp()),
                max_range=None,

                expected_start_date=fromtimestamp(datetime(2077, 9, 23).timestamp()),