Cleaned up n pairs parentheses solution notebook and unit test.

This commit is contained in:
Donne Martin
2015-08-11 21:13:35 -04:00
parent d35af98522
commit c868f891e7
2 changed files with 46 additions and 11 deletions

View File

@@ -1,17 +1,25 @@
from nose.tools import assert_equal
class TestPairParentheses(object):
def test_pair_parentheses(self, solution):
assert_equal(solution(0), set([]))
assert_equal(solution(1), set(['()']))
assert_equal(solution(2), set(['(())', '()()']))
assert_equal(solution(3), set(['((()))','(()())', '(())()', '()(())', '()()()']))
assert_equal(solution(2), set(['(())',
'()()']))
assert_equal(solution(3), set(['((()))',
'(()())',
'(())()',
'()(())',
'()()()']))
print('Success: test_pair_parentheses')
def main():
test = TestPairParentheses()
test.test_pair_parentheses(pair_parentheses)
if __name__ == '__main__':
main()