コード例 #1
0
    def test_withEmptyString_shouldReturn0(self):
        # with
        expression = ""
        # when
        result = longest_parenthesis(expression)

        # then
        assert result == 0
コード例 #2
0
    def test_withUnMatchedParentheses_shouldReturn0(self):
        # with
        expression = "() (()) ("
        # when
        result = longest_parenthesis(expression)

        # then
        assert result == 0
コード例 #3
0
    def test_withFilledSinglePair_shouldReturnlength(self):
        # with
        expression = "(1 + 3 + 4 * 7)"
        # when
        result = longest_parenthesis(expression)

        # then
        assert result == len(expression)
コード例 #4
0
    def test_withComplexExpression_shouldReturn4(self):
        # with
        expression = "() (()) ()"
        # when
        result = longest_parenthesis(expression)

        # then
        assert result == 4
コード例 #5
0
    def test_withSinglePair_shouldReturn2(self):
        # with
        expression = "()"
        # when
        result = longest_parenthesis(expression)

        # then
        assert result == 2