Ejemplo n.º 1
0
def test_unclosed_single_brackets():
    assert not is_valid_string('(')
    assert not is_valid_string('[')
    assert not is_valid_string('{')

    assert not is_valid_string(')')
    assert not is_valid_string(']')
    assert not is_valid_string('}')
Ejemplo n.º 2
0
def test_incorrect_symbols():
    with pytest.raises(Exception):
        is_valid_string("a")

    with pytest.raises(Exception):
        is_valid_string("(b)")
Ejemplo n.º 3
0
def test_deep_nested():
    input_string = "({[" * 10000 + "{}" * 2000 + "]})" * 10000
    assert is_valid_string(input_string)
Ejemplo n.º 4
0
def test_long_string_with_enclosing():
    input_string = "(" + "{()[]}" * 10000 + ")"
    assert is_valid_string(input_string)
Ejemplo n.º 5
0
def test_long_string_with_pattern():
    input_string = "{()[]}" * 10000
    assert is_valid_string(input_string)
Ejemplo n.º 6
0
def test_invalid_with_correct_amount():
    assert not is_valid_string("[(])")
    assert not is_valid_string("[({}])")
Ejemplo n.º 7
0
def test_invalid_examples_from_the_task():
    assert not is_valid_string("{)")
    assert not is_valid_string("{)(}")
Ejemplo n.º 8
0
def test_valid_examples_from_the_task():
    assert is_valid_string("{[]()}")
    assert is_valid_string("(){}")
    assert is_valid_string("[(){}]")
Ejemplo n.º 9
0
def test_nested():
    assert is_valid_string('(()[]{})')
    assert not is_valid_string('((})')
Ejemplo n.º 10
0
def test_simplest_correct():
    assert is_valid_string('()')
    assert is_valid_string('[]')
    assert is_valid_string('{}')
Ejemplo n.º 11
0
def test_empty():
    assert not is_valid_string('')