Beispiel #1
0
def test_rfc3339():
    """
    Assure that RFC3339 formatting is working.

    Warning: This test could get different results depending on if pytz and dateutil is installed.
    """

    n = utcnow()
    offset = n.tzinfo.utcoffset(n)
    assert offset == timedelta(0)

    str = generate_rfc3339(n)
    
    assert 'T' in str
    assert str.endswith('Z')

    dt = date_parse(str)

    # `generate_rfc3339` does not convert microseconds so we can't compare them
    odt = n.replace(microsecond=0)

    assert dt == odt
Beispiel #2
0
def test_rfc3339():
    """
    Assure that RFC3339 formatting is working.

    Warning: This test could get different results depending on if pytz and dateutil is installed.
    """

    n = utcnow()
    offset = n.tzinfo.utcoffset(n)
    assert offset == timedelta(0)

    str = generate_rfc3339(n)

    assert 'T' in str
    assert str.endswith('Z')

    dt = date_parse(str)

    # `generate_rfc3339` does not convert microseconds so we can't compare them
    odt = n.replace(microsecond=0)

    assert dt == odt
Beispiel #3
0
 def jsonify(self, value):
     """
     Get the date as a RFC3339 date-string
     """
     if value is not None:
         return generate_rfc3339(value)
Beispiel #4
0
 def jsonify(self, value):
     """
     Get the date as a RFC3339 date-string
     """
     if value is not None:
         return generate_rfc3339(value)