Skip to content
Open
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 garak/probes/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def braille(text):
"?": "\u2826",
"$": "\u2832",
":": "\u2812",
";": "\u2830",
";": "\u2806",
"(": "\u2836",
")": "\u2836",
"1": "\u2801",
Expand Down
22 changes: 22 additions & 0 deletions tests/probes/test_probes_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,25 @@ def test_atbash_function(plain, expected):
encoder = InjectAtbash.atbash # staticmethod reference
result = encoder(plain.encode()).decode()
assert result == expected


def test_braille_punctuation_cells():
"""Braille encoder must use the correct English/UEB cells for punctuation.

Regression for the semicolon, which was mapped to U+2830 (dots 5,6, the
letter-sign cell) instead of the semicolon cell U+2806 (dots 2,3). Every
other punctuation mark in the map already follows the standard, so this was
an isolated transcription error.
"""
expected = {
b",": "⠂", # dot 2
b";": "⠆", # dots 2,3
b":": "⠒", # dots 2,5
b".": "⠲", # dots 2,5,6
b"!": "⠖", # dots 2,3,5
b"?": "⠦", # dots 2,3,6
}
for char, cell in expected.items():
assert (
garak.probes.encoding.braille(char).decode() == cell
), f"{char!r} encoded to the wrong braille cell"
Loading