示例#1
0
def test_delorean_time_travel():
    "test the time travel capabilities"
    delo = Delorean()
    today = datetime.date.today()
    assert delo.get_date() == today

    tomorrow = datetime.date(2199, 12, 01)
    delo.set_target_date('01/12/2199')
    # no time travel
    assert delo.get_date() == today

    # insert plutonium
    delo.insert_plutonium()
    # no time travel
    assert delo.get_date() == today

    # go below 88mph
    delo.set_speed(87)
    # no time travel
    assert delo.get_date() == today

    # go beyond 88mph
    delo.set_speed(89)
    assert delo.get_date() == tomorrow
    assert delo.has_plutonium == False
示例#2
0
def test_delorean_get_date():
    "test the delorean plutonium insertion"
    delo = Delorean()
    assert delo.get_date() == datetime.date.today()
示例#3
0
def test_delorean():
    "Test the class initialisation"
    delo = Delorean()
    assert delo.get_speed() == 0
    assert delo.get_date() == datetime.date.today()
    assert delo.plutonium == False