# Path: htmlgen/time.py
# class Time(Element):
#     """An HTML date/time (<time>) element.
# 
#     >>> from datetime import date, datetime
#     >>> time1 = Time(date(2014, 12, 31))
#     >>> time1.append("new year's eve")
#     >>> str(time1)
#     '<time datetime="2014-12-31">new year&#x27;s eve</time>'
#     >>> time2 = Time(datetime(2014, 5, 17, 13, 15, 0))
#     >>> time2.append("May 17th, quarter past one")
#     >>> str(time2)
#     '<time datetime="2014-05-17T13:15:00Z">May 17th, quarter past one</time>'
#     """
# 
#     def __init__(self, date):
#         super().__init__("time")
#         if hasattr(date, "hour"):
#             formatted = date.strftime("%Y-%m-%dT%H:%M:%SZ")
#         else:
#             formatted = date.strftime("%Y-%m-%d")
#         self.set_attribute("datetime", formatted)


from datetime import datetime, date
from unittest import TestCase
from asserts import assert_equal
from htmlgen import Time




class TimeTest(TestCase):
    def test_date(self):
        time = Time(date(2013, 11, 3))
        time.append("Test")
        assert_equal(
            [b'<time datetime="2013-11-03">', b"Test", b"</time>"],
            list(iter(time)),
        )

    def test_datetime(self):

# Path: htmlgen/time.py
# class Time(Element):
#     """An HTML date/time (<time>) element.
# 
#     >>> from datetime import date, datetime
#     >>> time1 = Time(date(2014, 12, 31))
#     >>> time1.append("new year's eve")
#     >>> str(time1)
#     '<time datetime="2014-12-31">new year&#x27;s eve</time>'
#     >>> time2 = Time(datetime(2014, 5, 17, 13, 15, 0))
#     >>> time2.append("May 17th, quarter past one")
#     >>> str(time2)
#     '<time datetime="2014-05-17T13:15:00Z">May 17th, quarter past one</time>'
#     """
# 
#     def __init__(self, date):
#         super().__init__("time")
#         if hasattr(date, "hour"):
#             formatted = date.strftime("%Y-%m-%dT%H:%M:%SZ")
#         else:
#             formatted = date.strftime("%Y-%m-%d")
#         self.set_attribute("datetime", formatted)


# Path: test_htmlgen/time.py
from datetime import datetime, date
from unittest import TestCase
from asserts import assert_equal
from htmlgen import Time





class TimeTest(TestCase):
    def test_date(self):
        time = Time(date(2013, 11, 3))
        time.append("Test")
        assert_equal(
            [b'<time datetime="2013-11-03">', b"Test", b"</time>"],
            list(iter(time)),
        )

    def test_datetime(self):

        time = Time(datetime(2013, 4, 14, 12, 4, 13))