コード例 #1
0
def test_story_ellapsed_returns_seconds():
    story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some File")
    story.start_run()
    time.sleep(0.1)
    story.end_run()

    expected = "0.1"
    ellapsed = "%.1f" % story.ellapsed()
    assert ellapsed == expected, "The ellapsed time should be %s but was %s" % (expected, ellapsed)
コード例 #2
0
def test_story_ellapsed_returns_zero_for_non_started_stories():
    story = Story(as_a="Someone", i_want_to="Do Something", so_that="I'm Happy", identity="Some File")

    expected = 0
    ellapsed = int(story.ellapsed())
    assert ellapsed == expected, "The ellapsed time should be %d but was %d" % (expected, ellapsed)