Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@
]
},
{
"slug": "bracket-push",
"slug": "matching-brackets",
"uuid": "45229a7c-6703-4240-8287-16645881a043",
"core": false,
"unlocked_by": "isogram",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Bracket Push
# Matching Brackets

Given a string containing brackets `[]`, braces `{}`, parentheses `()`,
or any combination thereof, verify that any and all pairs are matched
and nested correctly.


## Exception messages

Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
Expand All @@ -22,11 +23,11 @@ raise Exception("Meaningful message indicating the source of the error")

To run the tests, run the appropriate command below ([why they are different](https://github.com/pytest-dev/pytest/issues/1629#issue-161422224)):

- Python 2.7: `py.test bracket_push_test.py`
- Python 3.4+: `pytest bracket_push_test.py`
- Python 2.7: `py.test matching_brackets_test.py`
- Python 3.4+: `pytest matching_brackets_test.py`

Alternatively, you can tell Python to run the pytest module (allowing the same command to be used regardless of Python version):
`python -m pytest bracket_push_test.py`
`python -m pytest matching_brackets_test.py`

### Common `pytest` options

Expand All @@ -38,7 +39,7 @@ For other options, see `python -m pytest -h`

## Submitting Exercises

Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/bracket-push` directory.
Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/matching-brackets` directory.

You can find your Exercism workspace by running `exercism debug` and looking for the line that starts with `Workspace`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import unittest

from bracket_push import is_paired
from matching_brackets import is_paired


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.5.0
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.0.0

class BracketPushTest(unittest.TestCase):
class MatchingBracketsTest(unittest.TestCase):
def test_paired_square_brackets(self):
self.assertEqual(is_paired("[]"), True)

Expand Down