diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7fcdbbd..b743e54dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt ## [Unreleased] ### Added - [.NET] Enabled overriding of parser's error-handling +- [Python] Expose Python public API as package imports ([#352](https://github.com/cucumber/gherkin/pull/352)) ### Fixed - [c] slight update to existing CMakeFiles.txt to propagate VERSION. Close #320 ([#328](https://github.com/cucumber/gherkin/pull/328)) diff --git a/README.md b/README.md index 2b860634b..f157c371e 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,9 @@ func main() { #### Python ```python -from gherkin.parser import Parser -from gherkin.pickles.compiler import Compiler +from gherkin import Compiler, Parser -parser = Parser() -gherkin_document = parser.parse("Feature: ...") +gherkin_document = Parser().parse("Feature: ...") gherkin_document["uri"] = "uri_of_the_feature.feature" pickles = Compiler().compile(gherkin_document) ``` diff --git a/python/gherkin/__init__.py b/python/gherkin/__init__.py index e69de29bb..1e244013f 100644 --- a/python/gherkin/__init__.py +++ b/python/gherkin/__init__.py @@ -0,0 +1,11 @@ +"""gherkin-official public API.""" + +from __future__ import annotations + +from .parser import Parser +from .pickles.compiler import Compiler + +__all__ = [ + "Compiler", + "Parser", +] diff --git a/python/test/count_symbols_test.py b/python/test/count_symbols_test.py deleted file mode 100644 index b449ff49b..000000000 --- a/python/test/count_symbols_test.py +++ /dev/null @@ -1,13 +0,0 @@ -def test_count_length_of_astral_point_symbols_correctly(): - string = "\U0001f63b" - assert 1 == len(string) - - -def test_count_length_of_ascii_symbols_correctly(): - string = "hello" - assert 5 == len(string) - - -def test_count_length_of_latin_symbols_correctly(): - string = "Scénario" - assert 8, len(string)