コード例 #1
0
ファイル: test_nptime.py プロジェクト: sbarysiuk/nptime
def test_subtract():
    t1 = nptime(minute=30)
    t2 = nptime(minute=31)

    assert_equal(t2 - t1, timedelta(seconds=60))

    assert_equal(t1 - (t2 - t1), timedelta(minutes=29))

    assert_equal(t2 - t1, -(t1 - t2))
コード例 #2
0
ファイル: test_nptime.py プロジェクト: tgs/nptime
def test_subtract():
    t1 = nptime(minute=30)
    t2 = nptime(minute=31)

    # There's one minute between those times.
    assert_equal(t2 - t1, timedelta(seconds=60))

    # If you take the interval between the times, and subtract it from one, you
    # get the other.
    assert_equal(t2 - (t2 - t1), t1)

    # Subtraction should be anticommutative
    assert_equal(t2 - t1, -(t1 - t2))
コード例 #3
0
ファイル: test_nptime.py プロジェクト: tgs/nptime
def test_addition():
    t = nptime(hour=6, minute=30, second=15, microsecond=3341)
    td = timedelta(seconds=30)
    t1 = t + td
    assert_equal(t.hour, t1.hour)
    assert_equal(t.minute, t1.minute)
    assert_equal(t.second, t1.second - 30)
    assert_equal(t.microsecond, t1.microsecond)

    assert_equal(t + td, td + t)
コード例 #4
0
ファイル: test_nptime.py プロジェクト: sbarysiuk/nptime
def test_addition():
    t = nptime(hour=6, minute=30, second=15, microsecond=3341)
    td = timedelta(seconds=30)
    t1 = t + td
    assert_equal(t.hour, t1.hour)
    assert_equal(t.minute, t1.minute)
    assert_equal(t.second, t1.second - 30)
    assert_equal(t.microsecond, t1.microsecond)

    assert_equal(t + td, td + t)
コード例 #5
0
ファイル: test_nptime.py プロジェクト: tgs/nptime
def test_creation():
    t = nptime()
コード例 #6
0
ファイル: test_nptime.py プロジェクト: sbarysiuk/nptime
def test_creation():
    t = nptime()