diff --git a/.github/actions/waffles/requirements.txt b/.github/actions/waffles/requirements.txt index f2a8976f..1fccab9a 100644 --- a/.github/actions/waffles/requirements.txt +++ b/.github/actions/waffles/requirements.txt @@ -1,4 +1,4 @@ docopt==0.6.2 Flask==2.3.3 markupsafe==2.1.5 -git+https://github.com/cds-snc/notifier-utils.git@52.3.1#egg=notifications-utils +git+https://github.com/cds-snc/notifier-utils.git@52.3.2#egg=notifications-utils diff --git a/Makefile b/Makefile index fb55d236..db74c0eb 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ clean-docker-containers: ## Clean up any remaining docker containers format: ruff check --select I --fix . ruff format . + ruff check poetry run mypy . poetry sort diff --git a/notifications_utils/clients/redis/bounce_rate.py b/notifications_utils/clients/redis/bounce_rate.py index 845108aa..526d4aa7 100644 --- a/notifications_utils/clients/redis/bounce_rate.py +++ b/notifications_utils/clients/redis/bounce_rate.py @@ -1,4 +1,5 @@ -"""This module is used to calculate the bounce rate for a service. It uses Redis to store the total number of hard bounces """ +"""This module is used to calculate the bounce rate for a service. It uses Redis to store the total number of hard bounces""" + from datetime import datetime from notifications_utils.clients.redis.redis_client import RedisClient diff --git a/notifications_utils/formatters.py b/notifications_utils/formatters.py index cb83e987..79ee215f 100644 --- a/notifications_utils/formatters.py +++ b/notifications_utils/formatters.py @@ -16,12 +16,12 @@ LINK_STYLE = "word-wrap: break-word;" OBSCURE_WHITESPACE = ( - "\u180E" # Mongolian vowel separator - "\u200B" # zero width space - "\u200C" # zero width non-joiner - "\u200D" # zero width joiner + "\u180e" # Mongolian vowel separator + "\u200b" # zero width space + "\u200c" # zero width non-joiner + "\u200d" # zero width joiner "\u2060" # word joiner - "\uFEFF" # zero width non-breaking space + "\ufeff" # zero width non-breaking space ) EMAIL_P_OPEN_TAG = '

' @@ -85,7 +85,7 @@ def unlink_govuk_escaped(message): - return re.sub(govuk_not_a_link, r"\1" + ".\u200B" + r"\2", message) # Unicode zero-width space + return re.sub(govuk_not_a_link, r"\1" + ".\u200b" + r"\2", message) # Unicode zero-width space def nl2br(value): diff --git a/notifications_utils/sanitise_text.py b/notifications_utils/sanitise_text.py index b1d91413..bbd55bd0 100644 --- a/notifications_utils/sanitise_text.py +++ b/notifications_utils/sanitise_text.py @@ -13,8 +13,8 @@ class SanitiseText: "’": "'", # RIGHT SINGLE QUOTATION MARK (U+2019) "“": '"', # LEFT DOUBLE QUOTATION MARK (U+201C) "”": '"', # RIGHT DOUBLE QUOTATION MARK (U+201D) - "\u200B": "", # ZERO WIDTH SPACE (U+200B) - "\u00A0": "", # NON BREAKING WHITE SPACE (U+200B) + "\u200b": "", # ZERO WIDTH SPACE (U+200B) + "\u00a0": "", # NON BREAKING WHITE SPACE (U+200B) "\t": " ", # TAB } diff --git a/notifications_utils/strftime_codes.py b/notifications_utils/strftime_codes.py index 410dc79d..b311c256 100644 --- a/notifications_utils/strftime_codes.py +++ b/notifications_utils/strftime_codes.py @@ -1,23 +1,23 @@ """This module provides platform compatible format codes for strftime. - By default, Python does not check the format codes sent to strftime: - these are sent directly to the platform's implementation. This leads - developers to use platform specific format codes for strftime that - can't easily run on other platforms that are popular and normally - easy to support for by the Python language. +By default, Python does not check the format codes sent to strftime: +these are sent directly to the platform's implementation. This leads +developers to use platform specific format codes for strftime that +can't easily run on other platforms that are popular and normally +easy to support for by the Python language. - Hence we have this module that makes the translation between platform - specific format codes. To refer to the different platform specific - codes and what is deemed safe (i.e. ANSI C/ POSIX compatible): +Hence we have this module that makes the translation between platform +specific format codes. To refer to the different platform specific +codes and what is deemed safe (i.e. ANSI C/ POSIX compatible): - For windows, see: - https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?redirectedfrom=MSDN&view=msvc-160 +For windows, see: +https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?redirectedfrom=MSDN&view=msvc-160 - For *nix compatible (non-POSIX compatible), see: - https://man7.org/linux/man-pages/man3/strftime.3.html +For *nix compatible (non-POSIX compatible), see: +https://man7.org/linux/man-pages/man3/strftime.3.html - 'somewhat POSIX'/ ANSI C compatible, see - https://en.cppreference.com/w/c/chrono/strftime +'somewhat POSIX'/ ANSI C compatible, see +https://en.cppreference.com/w/c/chrono/strftime """ import platform diff --git a/poetry.lock b/poetry.lock index 166fcd07..2c7b199d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -509,13 +509,13 @@ testing = ["pre-commit"] [[package]] name = "fakeredis" -version = "2.23.5" +version = "2.24.1" description = "Python implementation of redis API, can be used for testing purposes." optional = false python-versions = "<4.0,>=3.7" files = [ - {file = "fakeredis-2.23.5-py3-none-any.whl", hash = "sha256:4d85b1b6b3a80cbbb3a8967f8686f7bf6ddf5bd7cd5ac7ac90b3561d8c3a7ddb"}, - {file = "fakeredis-2.23.5.tar.gz", hash = "sha256:edffc79fdce0f1d83cbb20b52694a9cba4a5fe5beb627c11722a42aa0fa44f52"}, + {file = "fakeredis-2.24.1-py3-none-any.whl", hash = "sha256:09d3049a29910f80c0ef5789c31bef3dbb9727bd43a67ee8598217f4efd12f35"}, + {file = "fakeredis-2.24.1.tar.gz", hash = "sha256:4a52ab0edad53543ac5e3a41d761f91012613ed583344da54ae6473e05b0f6d0"}, ] [package.dependencies] @@ -894,13 +894,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pre-commit" -version = "3.7.1" +version = "3.8.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.9" files = [ - {file = "pre_commit-3.7.1-py2.py3-none-any.whl", hash = "sha256:fae36fd1d7ad7d6a5a1c0b0d5adb2ed1a3bda5a21bf6c3e5372073d7a11cd4c5"}, - {file = "pre_commit-3.7.1.tar.gz", hash = "sha256:8ca3ad567bc78a4972a3f1a477e94a79d4597e8140a6e0b651c5e33899c3654a"}, + {file = "pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f"}, + {file = "pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af"}, ] [package.dependencies] @@ -1226,28 +1226,29 @@ pyasn1 = ">=0.1.3" [[package]] name = "ruff" -version = "0.2.2" +version = "0.6.4" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.2.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0a9efb032855ffb3c21f6405751d5e147b0c6b631e3ca3f6b20f917572b97eb6"}, - {file = "ruff-0.2.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d450b7fbff85913f866a5384d8912710936e2b96da74541c82c1b458472ddb39"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ecd46e3106850a5c26aee114e562c329f9a1fbe9e4821b008c4404f64ff9ce73"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5e22676a5b875bd72acd3d11d5fa9075d3a5f53b877fe7b4793e4673499318ba"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1695700d1e25a99d28f7a1636d85bafcc5030bba9d0578c0781ba1790dbcf51c"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:b0c232af3d0bd8f521806223723456ffebf8e323bd1e4e82b0befb20ba18388e"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f63d96494eeec2fc70d909393bcd76c69f35334cdbd9e20d089fb3f0640216ca"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6a61ea0ff048e06de273b2e45bd72629f470f5da8f71daf09fe481278b175001"}, - {file = "ruff-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e1439c8f407e4f356470e54cdecdca1bd5439a0673792dbe34a2b0a551a2fe3"}, - {file = "ruff-0.2.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:940de32dc8853eba0f67f7198b3e79bc6ba95c2edbfdfac2144c8235114d6726"}, - {file = "ruff-0.2.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0c126da55c38dd917621552ab430213bdb3273bb10ddb67bc4b761989210eb6e"}, - {file = "ruff-0.2.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:3b65494f7e4bed2e74110dac1f0d17dc8e1f42faaa784e7c58a98e335ec83d7e"}, - {file = "ruff-0.2.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1ec49be4fe6ddac0503833f3ed8930528e26d1e60ad35c2446da372d16651ce9"}, - {file = "ruff-0.2.2-py3-none-win32.whl", hash = "sha256:d920499b576f6c68295bc04e7b17b6544d9d05f196bb3aac4358792ef6f34325"}, - {file = "ruff-0.2.2-py3-none-win_amd64.whl", hash = "sha256:cc9a91ae137d687f43a44c900e5d95e9617cb37d4c989e462980ba27039d239d"}, - {file = "ruff-0.2.2-py3-none-win_arm64.whl", hash = "sha256:c9d15fc41e6054bfc7200478720570078f0b41c9ae4f010bcc16bd6f4d1aacdd"}, - {file = "ruff-0.2.2.tar.gz", hash = "sha256:e62ed7f36b3068a30ba39193a14274cd706bc486fad521276458022f7bccb31d"}, + {file = "ruff-0.6.4-py3-none-linux_armv6l.whl", hash = "sha256:c4b153fc152af51855458e79e835fb6b933032921756cec9af7d0ba2aa01a258"}, + {file = "ruff-0.6.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:bedff9e4f004dad5f7f76a9d39c4ca98af526c9b1695068198b3bda8c085ef60"}, + {file = "ruff-0.6.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d02a4127a86de23002e694d7ff19f905c51e338c72d8e09b56bfb60e1681724f"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7862f42fc1a4aca1ea3ffe8a11f67819d183a5693b228f0bb3a531f5e40336fc"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eebe4ff1967c838a1a9618a5a59a3b0a00406f8d7eefee97c70411fefc353617"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:932063a03bac394866683e15710c25b8690ccdca1cf192b9a98260332ca93408"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:50e30b437cebef547bd5c3edf9ce81343e5dd7c737cb36ccb4fe83573f3d392e"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c44536df7b93a587de690e124b89bd47306fddd59398a0fb12afd6133c7b3818"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ea086601b22dc5e7693a78f3fcfc460cceabfdf3bdc36dc898792aba48fbad6"}, + {file = "ruff-0.6.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b52387d3289ccd227b62102c24714ed75fbba0b16ecc69a923a37e3b5e0aaaa"}, + {file = "ruff-0.6.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0308610470fcc82969082fc83c76c0d362f562e2f0cdab0586516f03a4e06ec6"}, + {file = "ruff-0.6.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:803b96dea21795a6c9d5bfa9e96127cc9c31a1987802ca68f35e5c95aed3fc0d"}, + {file = "ruff-0.6.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:66dbfea86b663baab8fcae56c59f190caba9398df1488164e2df53e216248baa"}, + {file = "ruff-0.6.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:34d5efad480193c046c86608dbba2bccdc1c5fd11950fb271f8086e0c763a5d1"}, + {file = "ruff-0.6.4-py3-none-win32.whl", hash = "sha256:f0f8968feea5ce3777c0d8365653d5e91c40c31a81d95824ba61d871a11b8523"}, + {file = "ruff-0.6.4-py3-none-win_amd64.whl", hash = "sha256:549daccee5227282289390b0222d0fbee0275d1db6d514550d65420053021a58"}, + {file = "ruff-0.6.4-py3-none-win_arm64.whl", hash = "sha256:ac4b75e898ed189b3708c9ab3fc70b79a433219e1e87193b4f2b77251d058d14"}, + {file = "ruff-0.6.4.tar.gz", hash = "sha256:ac3b5bfbee99973f80aa1b7cbd1c9cbce200883bdd067300c22a6cc1c7fba212"}, ] [[package]] @@ -1370,13 +1371,13 @@ files = [ [[package]] name = "types-cachetools" -version = "5.3.0.7" +version = "5.5.0.20240820" description = "Typing stubs for cachetools" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "types-cachetools-5.3.0.7.tar.gz", hash = "sha256:27c982cdb9cf3fead8b0089ee6b895715ecc99dac90ec29e2cab56eb1aaf4199"}, - {file = "types_cachetools-5.3.0.7-py3-none-any.whl", hash = "sha256:98c069dc7fc087b1b061703369c80751b0a0fc561f6fb072b554e5eee23773a0"}, + {file = "types-cachetools-5.5.0.20240820.tar.gz", hash = "sha256:b888ab5c1a48116f7799cd5004b18474cd82b5463acb5ffb2db2fc9c7b053bc0"}, + {file = "types_cachetools-5.5.0.20240820-py3-none-any.whl", hash = "sha256:efb2ed8bf27a4b9d3ed70d33849f536362603a90b8090a328acf0cd42fda82e2"}, ] [[package]] @@ -1545,4 +1546,4 @@ watchdog = ["watchdog (>=2.3)"] [metadata] lock-version = "2.0" python-versions = "~3.10.9" -content-hash = "38718f1a99e6fb6cbee4e8b999bdf666099bc78dd5e197d822df00c29aaef261" +content-hash = "66c76f6892001c0ccd4e07e750094b85139ec0eec58f43b40219b70a7d29f89f" diff --git a/pyproject.toml b/pyproject.toml index 819f3489..6823dd5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "notifications-utils" -version = "52.3.1" +version = "52.3.2" description = "Shared python code for Notification - Provides logging utils etc." authors = ["Canadian Digital Service"] license = "MIT license" @@ -30,7 +30,7 @@ markupsafe = "2.1.5" mistune = "0.8.4" ordered-set = "4.1.0" phonenumbers = "8.13.42" -pre-commit = "^3.7.1" +pre-commit = "^3.8.0" py_w3c = "0.3.1" pypdf2 = "1.28.6" python-json-logger = "2.0.7" @@ -44,7 +44,7 @@ werkzeug = "3.0.3" [tool.poetry.group.test.dependencies] beautifulsoup4 = "^4.12.3" click = "8.1.7" -fakeredis = "^2.10.3" +fakeredis = "^2.24.1" freezegun = "1.5.1" mypy = "1.10.0" pytest = "7.4.4" @@ -52,10 +52,10 @@ pytest-cov = "2.12.1" pytest-mock = "3.14.0" pytest-xdist = "2.5.0" requests-mock = "1.12.1" -ruff = "^0.2.1" +ruff = "^0.6.0" types-beautifulsoup4 = "^4.12.0.20240229" types-bleach = "5.0.3.1" -types-cachetools = "5.3.0.7" +types-cachetools = "5.5.0.20240820" types-python-dateutil = "2.9.0.20240316" types-pytz = "2022.7.1.2" types-PyYAML = "6.0.12.20240724" diff --git a/tests/test_formatters.py b/tests/test_formatters.py index c8007207..648bd6ff 100644 --- a/tests/test_formatters.py +++ b/tests/test_formatters.py @@ -168,9 +168,9 @@ def test_preserves_whitespace_when_making_links(markdown_function, expected_outp @pytest.mark.parametrize( "template_content,expected", [ - ("gov.uk", "gov.\u200Buk"), - ("GOV.UK", "GOV.\u200BUK"), - ("Gov.uk", "Gov.\u200Buk"), + ("gov.uk", "gov.\u200buk"), + ("GOV.UK", "GOV.\u200bUK"), + ("Gov.uk", "Gov.\u200buk"), ("https://gov.uk", "https://gov.uk"), ("https://www.gov.uk", "https://www.gov.uk"), ("www.gov.uk", "www.gov.uk"), @@ -951,7 +951,7 @@ def test_make_list_from_linebreaks(): """ \t bar """, - " \u180E\u200B \u200C bar \u200D \u2060\uFEFF ", + " \u180e\u200b \u200c bar \u200d \u2060\ufeff ", ], ) def test_strip_whitespace(value): @@ -963,7 +963,7 @@ def test_strip_whitespace(value): [ "notifications-email", " \tnotifications-email \x0c ", - "\rn\u200Coti\u200Dfi\u200Bcati\u2060ons-\u180Eemai\uFEFFl\uFEFF", + "\rn\u200coti\u200dfi\u200bcati\u2060ons-\u180eemai\ufeffl\ufeff", ], ) def test_strip_and_remove_obscure_whitespace(value): @@ -996,7 +996,7 @@ def test_strip_unsupported_characters(): def test_normalise_whitespace(): - assert normalise_whitespace("\u200C Your tax is\ndue\n\n") == "Your tax is due" + assert normalise_whitespace("\u200c Your tax is\ndue\n\n") == "Your tax is due" class TestAddLanguageDivs: diff --git a/tests/test_logging.py b/tests/test_logging.py index 72c1060c..fc108088 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -65,8 +65,8 @@ class App: handlers = logging.get_handlers(app) assert len(handlers) == 1 - assert type(handlers[0]) == builtin_logging.StreamHandler - assert type(handlers[0].formatter) == logging.CustomLogFormatter + assert type(handlers[0]) is builtin_logging.StreamHandler + assert type(handlers[0].formatter) is logging.CustomLogFormatter assert not (tmpdir / "foo").exists() @@ -85,8 +85,8 @@ class App: handlers = logging.get_handlers(app) assert len(handlers) == 1 - assert type(handlers[0]) == builtin_logging.StreamHandler - assert type(handlers[0].formatter) == logging.JSONFormatter + assert type(handlers[0]) is builtin_logging.StreamHandler + assert type(handlers[0].formatter) is logging.JSONFormatter # assert type(handlers[1]) == builtin_logging_handlers.WatchedFileHandler # assert type(handlers[1].formatter) == logging.JSONFormatter diff --git a/tests/test_recipient_csv.py b/tests/test_recipient_csv.py index 033c951a..06442f56 100644 --- a/tests/test_recipient_csv.py +++ b/tests/test_recipient_csv.py @@ -844,14 +844,14 @@ def test_ignores_spaces_and_case_in_placeholders(key, expected): ("\n", None), # newline ("\r", None), # carriage return ("\t", None), # tab - ("\u180E", "MONGOLIAN VOWEL SEPARATOR"), - ("\u200B", "ZERO WIDTH SPACE"), - ("\u200C", "ZERO WIDTH NON-JOINER"), - ("\u200D", "ZERO WIDTH JOINER"), + ("\u180e", "MONGOLIAN VOWEL SEPARATOR"), + ("\u200b", "ZERO WIDTH SPACE"), + ("\u200c", "ZERO WIDTH NON-JOINER"), + ("\u200d", "ZERO WIDTH JOINER"), ("\u2060", "WORD JOINER"), - ("\uFEFF", "ZERO WIDTH NO-BREAK SPACE"), + ("\ufeff", "ZERO WIDTH NO-BREAK SPACE"), # all the things - (" \n\r\t\u000A\u000D\u180E\u200B\u200C\u200D\u2060\uFEFF", None), + (" \n\r\t\u000a\u000d\u180e\u200b\u200c\u200d\u2060\ufeff", None), ), ) def test_ignores_leading_whitespace_in_file(character, name): diff --git a/tests/test_recipient_validation.py b/tests/test_recipient_validation.py index f3d74cf2..0cc55979 100644 --- a/tests/test_recipient_validation.py +++ b/tests/test_recipient_validation.py @@ -332,7 +332,7 @@ def test_validate_email_address_accepts_valid(email_address): " email@domain.com ", "\temail@domain.com", "\temail@domain.com\n", - "\u200Bemail@domain.com\u200B", + "\u200bemail@domain.com\u200b", ], ) def test_validate_email_address_strips_whitespace(email): @@ -400,7 +400,7 @@ def test_validate_address_allows_any_non_empty_value(column): ], ) def test_non_ascii_address_line_is_fine(column): - valid_address = "\u041F\u0435\u0442\u044F" + valid_address = "\u041f\u0435\u0442\u044f" assert validate_recipient(valid_address, "letter", column=column) == valid_address diff --git a/tests/test_sanitise_text.py b/tests/test_sanitise_text.py index a8d458bc..cf4a5292 100644 --- a/tests/test_sanitise_text.py +++ b/tests/test_sanitise_text.py @@ -16,7 +16,7 @@ def test_encode_chars_sms_fr_not_downgraded(chars, cls): (("–", "-"), "compatibility transform unicode char (EN DASH (U+2013)"), (("—", "-"), "compatibility transform unicode char (EM DASH (U+2014)"), (("…", "..."), "compatibility transform unicode char (HORIZONTAL ELLIPSIS (U+2026)"), - (("\u200B", ""), "compatibility transform unicode char (ZERO WIDTH SPACE (U+200B)"), + (("\u200b", ""), "compatibility transform unicode char (ZERO WIDTH SPACE (U+200B)"), (("‘", "'"), "compatibility transform unicode char (LEFT SINGLE QUOTATION MARK (U+2018)"), (("’", "'"), "compatibility transform unicode char (RIGHT SINGLE QUOTATION MARK (U+2019)"), (("“", '"'), "compatibility transform unicode char (LEFT DOUBLE QUOTATION MARK (U+201C) "), diff --git a/tests/test_template_types.py b/tests/test_template_types.py index a5c80c87..abf9acc8 100644 --- a/tests/test_template_types.py +++ b/tests/test_template_types.py @@ -484,9 +484,9 @@ def test_HTML_template_has_URLs_replaced_with_links(content, html_snippet): @pytest.mark.parametrize( "template_content,expected", [ - ("gov.uk", "gov.\u200Buk"), - ("GOV.UK", "GOV.\u200BUK"), - ("Gov.uk", "Gov.\u200Buk"), + ("gov.uk", "gov.\u200buk"), + ("GOV.UK", "GOV.\u200bUK"), + ("Gov.uk", "Gov.\u200buk"), ("https://gov.uk", "https://gov.uk"), ("https://www.gov.uk", "https://www.gov.uk"), ("www.gov.uk", "www.gov.uk"), @@ -2064,7 +2064,7 @@ def test_whitespace_in_subjects(template_class, subject, extra_args): ) def test_whitespace_in_subject_placeholders(template_class): assert ( - template_class({"content": "", "subject": "\u200C Your tax ((status))"}, values={"status": " is\ndue "}).subject + template_class({"content": "", "subject": "\u200c Your tax ((status))"}, values={"status": " is\ndue "}).subject == "Your tax is due" )