interactive-coding-challenges/recursion_dynamic/steps/test_steps.py

25 lines
649 B
Python
Raw Normal View History

2017-03-27 17:19:37 +08:00
from nose.tools import assert_equal, assert_raises
class TestSteps(object):
def test_steps(self):
steps = Steps()
assert_raises(TypeError, steps.count_ways, None)
assert_raises(TypeError, steps.count_ways, -1)
assert_equal(steps.count_ways(0), 1)
assert_equal(steps.count_ways(1), 1)
assert_equal(steps.count_ways(2), 2)
assert_equal(steps.count_ways(3), 4)
assert_equal(steps.count_ways(4), 7)
assert_equal(steps.count_ways(10), 274)
print('Success: test_steps')
def main():
test = TestSteps()
test.test_steps()
if __name__ == '__main__':
main()