import unittest
from hypothesis import given
from hypothesis.extra.datetime import datetimes

import qual

from datetime import date

class TestIsoUtils(unittest.TestCase):
    @given(datetimes(timezones=[]))
    def test_round_trip_date(self, dt):
        d = dt.date()
        self.assertEqual(qual.iso_to_gregorian(*d.isocalendar()), d)


import unittest
from hypothesis import given
from hypothesis.strategies import integers
from hypothesis.extra.datetime import datetimes

import qual

from datetime import date, MINYEAR, MAXYEAR

class TestIsoUtils(unittest.TestCase):
    @given(datetimes(timezones=[]))
    def test_round_trip_date(self, dt):
        d = dt.date()
        self.assertEqual(qual.iso_to_gregorian(*d.isocalendar()), d)

    @given(integers(MINYEAR, MAXYEAR), integers(1, 52), integers(1, 7))
    def test_round_trip_iso_date(self, year, week, day):
        y, w, d = qual.iso_to_gregorian(year, week, day).isocalendar()
        self.assertEqual(year, y)
        self.assertEqual(week, w)
        self.assertEqual(day, d)


Add a new test for roundtripping in the opposite direction.
Add a new test for roundtripping in the opposite direction.
