Example #1
0
def test_duration_microseconds():
    """Test duration parser function on duration strings with microseconds."""
    assert duration('0:00:00.001') == datetime.timedelta(0, 0, 1000)
    assert duration('0:00:00.12') == datetime.timedelta(0, 0, 120000)
    assert duration('0:00:00.120') == datetime.timedelta(0, 0, 120000)
    assert duration('0:00:00.052') == datetime.timedelta(0, 0, 52000)
    assert duration('0:00:03.523') == datetime.timedelta(0, 3, 523000)
Example #2
0
def test_duration_microseconds():
    """Test duration parser function on duration strings with microseconds."""
    assert duration('0:00:00.001') == datetime.timedelta(0, 0, 1000)
    assert duration('0:00:00.12') == datetime.timedelta(0, 0, 120000)
    assert duration('0:00:00.120') == datetime.timedelta(0, 0, 120000)
    assert duration('0:00:00.052') == datetime.timedelta(0, 0, 52000)
    assert duration('0:00:03.523') == datetime.timedelta(0, 3, 523000)
Example #3
0
def test_duration_seconds():
    """Test duration parser function on duration strings with no microseconds."""
    assert duration('0:00:00') == datetime.timedelta(0)
    assert duration('0:00:03') == datetime.timedelta(0, 3)
Example #4
0
def test_duration_seconds():
    """Test duration parser function on duration strings with no microseconds."""
    assert duration('0:00:00') == datetime.timedelta(0)
    assert duration('0:00:03') == datetime.timedelta(0, 3)