def test_no_extra():
    for d in testSymbols:
        o, c = d
        assert parenthetics("{}{}".format(o, c), d) == 0
        assert parenthetics("{}{}{}{}".format(o, c, o, c), d) == 0
        assert parenthetics("{}{}{}{}".format(o, o, c, c), d) == 0
        assert parenthetics("{}adding{}text{}{}".format(
                            o, o, o, o) + testText + "{}works{}too{}{}".format(
                            c, c, c, c), d) == 0
Пример #2
0
def test_parenthetics_with_complicated_balanced_seq():
    """Test balanced sequence."""
    from parenthetics import parenthetics
    assert parenthetics('((()((()))())())()()(())') == 0
Пример #3
0
def test_parenthetics_with_simple_broken_seq_again():
    """Test broken sequence."""
    from parenthetics import parenthetics
    assert parenthetics('((())))') == -1
Пример #4
0
def test_parenthetics_with_complicated_open_seq():
    """Test open sequence."""
    from parenthetics import parenthetics
    assert parenthetics('((()((()))())())()()((())(') == 1
Пример #5
0
def test_parenthetics(data, result):
    """Assert the parenthetics function outputs the proper number."""
    assert parenthetics(data) == result
Пример #6
0
def test_parenthetics(WORDS):
    """Test parenthetics method."""
    from parenthetics import parenthetics
    assert parenthetics(WORDS[0]) is WORDS[1]