kyu_6.valid_braces package

Submodules

kyu_6.valid_braces.test_valid_braces module

Test for -> Valid Braces.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_6.valid_braces.test_valid_braces.ValidBracesTestCase(methodName='runTest')[source]

Bases: TestCase

Testing the ‘valid_braces’ function.

_classSetupFailed = False
_class_cleanups = []
test_valid_braces = None
test_valid_braces_00__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’(){}[]’, expected=True].

Returns:

test_valid_braces_01__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’([{}])’, expected=True].

Returns:

test_valid_braces_02__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’(}’, expected=False].

Returns:

test_valid_braces_03__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’[(])’, expected=False].

Returns:

test_valid_braces_04__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’[({})](]’, expected=False].

Returns:

test_valid_braces_05__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’()’, expected=True].

Returns:

test_valid_braces_06__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’[]’, expected=True].

Returns:

test_valid_braces_07__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’[(])’, expected=False].

Returns:

test_valid_braces_08__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’{}’, expected=True].

Returns:

test_valid_braces_09__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’{}()[]’, expected=True].

Returns:

test_valid_braces_10__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’([{}])’, expected=True].

Returns:

test_valid_braces_11__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’([}{])’, expected=False].

Returns:

test_valid_braces_12__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’{}({})[]’, expected=True].

Returns:

test_valid_braces_13__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’(({{[[]]}}))’, expected=True].

Returns:

test_valid_braces_14__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’(((({{’, expected=False].

Returns:

test_valid_braces_15__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’)(}{][’, expected=False].

Returns:

test_valid_braces_16__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’())({}}{()][][’, expected=False].

Returns:

test_valid_braces_17__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’{}()[]’, expected=True].

Returns:

test_valid_braces_18__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’([}{])’, expected=False].

Returns:

test_valid_braces_19__(**kw)

Testing the ‘valid_braces’ function with various test data [with string=’{}({})[]’, expected=True].

Returns:

kyu_6.valid_braces.valid_braces module

Test for -> Valid Braces.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_6.valid_braces.valid_braces.valid_braces(string: str) bool[source]

Validate braces.

A function that takes a string of braces, and determines if the order of the braces is valid. It should return true if the string is valid, and false if it’s invalid. :param string: a string consist of brackets :return: boolean, indicates if input string is valid

kyu_6.valid_braces.valid_braces.validate_next_pair(string: str, index: int) int[source]

Check if next pair of brackets is valid.

Parameters:
  • string – string of brackets

  • index – current index to validate, -1 for None

Returns:

next index or None if no matching brackets

Module contents

Valid Braces.