Sha256: 0040455fcea2956b71911d679cf9fcef18081ef44ff9f218e8722f59f26ecece

Contents?: true

Size: 960 Bytes

Versions: 125

Compression:

Stored size: 960 Bytes

Contents

import unittest

from bracket_push import check_brackets


class BracketPushTests(unittest.TestCase):

    def test_input_empty(self):
        self.assertEqual(check_brackets(""), True)

    def test_single(self):
        self.assertEqual(check_brackets("{}"), True)

    def test_unclosed(self):
        self.assertEqual(check_brackets("{{"), False)

    def test_wrong_order(self):
        self.assertEqual(check_brackets("}{"), False)

    def test_mixed_not_nested(self):
        self.assertEqual(check_brackets("{}[]"), True)

    def test_mixed_nested(self):
        self.assertEqual(check_brackets("{[]}"), True)

    def test_improperly_nested(self):
        self.assertEqual(check_brackets("{[}]"), False)

    def test_not_opened_nested(self):
        self.assertEqual(check_brackets("{[)][]}"), False)

    def test_nested_ensemble(self):
        self.assertEqual(check_brackets("{[]([()])}"), True)


if __name__ == '__main__':
    unittest.main()

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.0.6.9 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.8 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.7 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.6 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.5 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.4 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.3 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.2 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.1 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.6.0 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.18 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.17 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.16 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.15 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.14 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.13 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.12 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.11 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.10 tracks/python/exercises/bracket-push/bracket_push_test.py
trackler-2.0.5.9 tracks/python/exercises/bracket-push/bracket_push_test.py