Files
interactive-coding-challenges/math_probability/power_two/test_is_power_of_two.py
2017-03-29 04:41:58 -04:00

23 lines
655 B
Python

from nose.tools import assert_equal, assert_raises
class TestSolution(object):
def test_is_power_of_two(self):
solution = Solution()
assert_raises(TypeError, solution.is_power_of_two, None)
assert_equal(solution.is_power_of_two(0), False)
assert_equal(solution.is_power_of_two(1), True)
assert_equal(solution.is_power_of_two(2), True)
assert_equal(solution.is_power_of_two(15), False)
assert_equal(solution.is_power_of_two(16), True)
print('Success: test_is_power_of_two')
def main():
test = TestSolution()
test.test_is_power_of_two()
if __name__ == '__main__':
main()