diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cae1d39..3b9d27d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: [3.8, 3.9, "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] include: - os: macos-latest python-version: "3.11" diff --git a/pyproject.toml b/pyproject.toml index b68f855..e90df06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", ] diff --git a/regexmodel/regexclass.py b/regexmodel/regexclass.py index 62134f0..e9f3cc4 100644 --- a/regexmodel/regexclass.py +++ b/regexmodel/regexclass.py @@ -418,8 +418,8 @@ def draw_once(self): @classmethod def from_string(cls, regex_str) -> Optional[tuple[BaseRegex, str]]: - _special_chars = [".", "+", "*", "?", "^", "$", "(", ")", "[", "]", - "{", "}", "|", "\\", "-", "~", "\r"] + _special_chars = [".", "+", "*", "?", "^", "$", "(", ")", "[", "]", "#", "&", + "{", "}", "|", "\\", "-", "~", "\r", "\t", "\x0b", "\x0c", "\n"] if len(regex_str) > 1 and regex_str[0] == "\\" and regex_str[1] in _special_chars: return cls([_unescape(regex_str[1])]), regex_str[2:] if len(regex_str) >= 1 and regex_str[0] != "\\" and regex_str[0] not in _special_chars: diff --git a/tests/test_regex.py b/tests/test_regex.py index 42541de..32f6af1 100644 --- a/tests/test_regex.py +++ b/tests/test_regex.py @@ -1,4 +1,5 @@ from pytest import mark +import string from regexmodel import RegexModel @@ -33,6 +34,10 @@ def test_full_pipeline(series, regex, counts): assert model.regex == new_model.regex assert new_model.serialize()["counts"] == model.serialize()["counts"] +def test_all_chars(): + model = RegexModel.fit(list(string.printable), count_thres=1) + new_model = RegexModel(model.serialize()) + assert isinstance(new_model, RegexModel) # @mark.parametrize(