Exemplo n.º 1
0
def test_calculate_age_years():
    created = parser.parse('2020-10-20T17:49:45.000000000Z')
    now = datetime.fromtimestamp(1761414585.0, tz=timezone.utc)
    age = {'number': 5, 'unit': 'years'}

    assert calculate_age(created, now) == age
Exemplo n.º 2
0
def test_calculate_age_seconds():
    created = parser.parse('2020-10-20T17:49:45.000000000Z')
    now = datetime.fromtimestamp(1603216190.0, tz=timezone.utc)
    age = {'number': 5, 'unit': 'seconds'}

    assert calculate_age(created, now) == age
Exemplo n.º 3
0
def test_calculate_age_weeks():
    created = parser.parse('2020-10-20T17:49:45.000000000Z')
    now = datetime.fromtimestamp(1604512185.0, tz=timezone.utc)
    age = {'number': 2, 'unit': 'weeks'}

    assert calculate_age(created, now) == age