Example #1
0
def test_strftimeEx_03():
    t = 0.678910
    fmt = "%(ms)"
    # According to the code, the number that replaces (ms) is *rounded*,
    # so this formt should give "679".
    result = strftimeEx(fmt, t)
    assert result == "679"
Example #2
0
def test_strftimeEx_07():
    """Test rounding that affects the seconds."""
    t = 7.9996
    fmt = "%S %(ms_)"
    result = strftimeEx(fmt, t)
    expected = "07 999"
    print 'result = "%s"  expected = "%s"' % (result, expected)
    assert result == expected
Example #3
0
def test_strftimeEx_04():
    t = 0.678910
    fmt = "%(ms_).%(us)ms"
    # The format "%(ms_)" uses floor().
    result = strftimeEx(fmt, t)
    expected = "678.910ms"
    print 'result = "%s"  expected = "%s"' % (result, expected)
    assert result == expected
Example #4
0
def test_strftimeEx_04():
    t = 0.678910
    fmt = "%(ms).%(us)ms"
    # According to the code, the number that replaces (ms) is *rounded*,
    # so this formt should give "679.910ms".  (See the next test case for the
    # correct way to do this.)
    result = strftimeEx(fmt, t)
    expected = "679.910ms"
    assert result == expected
Example #5
0
def test_strftimeEx_01():
    t = 0.123
    fmt = "%(ms)"
    result = strftimeEx(fmt, t)
    assert result == "123"
Example #6
0
def test_strftimeEx_02():
    t = 0.123456
    fmt = "%(us)"
    result = strftimeEx(fmt, t)
    assert result == "456"