Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Fix bad start or end symbol error (#167)
Browse files Browse the repository at this point in the history
* Fix ValueError error message

* Better test to for ValueError message

* Update the changelog

* Raw format string to appease flake8
  • Loading branch information
JohnGiorgi authored Nov 16, 2020
1 parent 8a305a0 commit 236034f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed `pair-classification-esim` pretrained model.
- Fixed `ValueError` error message in `Seq2SeqDatasetReader`.

### Added

Expand Down
2 changes: 1 addition & 1 deletion allennlp_models/generation/dataset_readers/seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(
)
except ValueError:
raise ValueError(
f"Bad start or end symbol ({'start_symbol', 'end_symbol'}) "
f"Bad start or end symbol ('{start_symbol}', '{end_symbol}') "
f"for tokenizer {self._source_tokenizer}"
)

Expand Down
2 changes: 1 addition & 1 deletion tests/generation/dataset_readers/seq2seq_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ def test_correct_quote_handling(self, line):
]

def test_bad_start_or_end_symbol(self):
with pytest.raises(ValueError, match="Bad start or end symbol"):
with pytest.raises(ValueError, match=r"Bad start or end symbol \('BAD SYMBOL"):
Seq2SeqDatasetReader(start_symbol="BAD SYMBOL")

0 comments on commit 236034f

Please sign in to comment.