コード例 #1
0
def doframe(t: unittest.TestCase, curr: sllib.Frame, prev: sllib.Frame):
    """Validate some basic data for the frame"""
    t.assertGreaterEqual(curr.course, 0)
    t.assertLessEqual(curr.course, 6.28)
    t.assertLess(curr.gps_speed, 15)
    t.assertLess(curr.altitude, 500)
    t.assertLess(curr.temperature, 22)
    t.assertGreater(curr.temperature, 10)
    t.assertGreater(curr.framesize, curr.packetsize)
    t.assertGreater(curr.framesize, 1900)
    t.assertLessEqual(len(curr.packet), curr.packetsize)
    if prev is not None:
        t.assertGreater(curr.offset, prev.offset)
        t.assertGreaterEqual(curr.time1, prev.time1)
コード例 #2
0
ファイル: test_watchdog.py プロジェクト: BoniLindsley/phile
def assert_entry_is(
    test_case: unittest.TestCase,
    entry: phile.notify.Entry,
    target_entry: phile.notify.Entry,
    modified_interval: TimeInterval,
) -> None:
    test_case.assertEqual(entry.name, target_entry.name)
    test_case.assertEqual(entry.text, target_entry.text)
    test_case.assertGreaterEqual(
        entry.modified_at,
        round_down_to_two_seconds(modified_interval.before),
    )
    test_case.assertLessEqual(
        entry.modified_at,
        round_up_to_two_seconds(modified_interval.after),
    )