Skip to content

Commit cf9b10e

Browse files
committed
ENH: Test writer: Test for unavailable unicode characters
1 parent aeade86 commit cf9b10e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_writer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,14 +1730,20 @@ def test_update_form_fields2(caplog):
17301730

17311731

17321732
@pytest.mark.enable_socket
1733-
def test_update_form_fields3():
1733+
def test_update_form_fields3(caplog):
17341734
if HAS_FONTTOOLS:
1735+
pua_string = ""
1736+
for code in range(0xE000, 0xE010):
1737+
char = chr(code)
1738+
pua_string += char
1739+
17351740
url = "https://github.com/user-attachments/files/21073581/CERERE.INMATRICULARE.form.pdf"
17361741
name = "iss3361.pdf"
17371742
writer = PdfWriter()
17381743
writer.append(BytesIO(get_data_from_url(url, name=name)))
17391744
data = {
17401745
"subsemnatul": "Σὲ γνωρίζω ἀπὸ τὴν κόψη",
1746+
"localitatea": pua_string,
17411747
"strada": "Căpitan Nicolae Licăreț",
17421748
"adresa_judet": "Конференция",
17431749
}
@@ -1754,6 +1760,7 @@ def test_update_form_fields3():
17541760
found_hex = re.findall(r"<(.*?)>", apstream_object.decode())
17551761
expected_hex = data["adresa_judet"].encode("utf-16-be").hex()
17561762
assert expected_hex in found_hex
1763+
assert f"Text string '{pua_string}' contains characters not supported by font encoding." in caplog.text
17571764

17581765

17591766
@pytest.mark.enable_socket

0 commit comments

Comments
 (0)