Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10 feature "Structural Pattern Matching" not supported #324

Open
sschulz92 opened this issue Jan 31, 2024 · 0 comments
Open

Python 3.10 feature "Structural Pattern Matching" not supported #324

sschulz92 opened this issue Jan 31, 2024 · 0 comments

Comments

@sschulz92
Copy link

Describe the bug

If I want to use the match-case pattern, I can see parse error in the output. I could not find any information which Python versions are officially supported by this plugin. The only information I could find is the file "setup.tmpl" with the newest Python version 3.7.

Please use the following screenshot as the easiest way to reproduce it. This is not how I want to use the match-case in production.

image_2024-01-31_093714987

To Reproduce
Steps (or project) to reproduce the behavior:

  1. Initialise a gauge project: gauge init python
  2. Use the following piece of code:
@step("Almost all words have vowels <table>")
def assert_words_vowel_count(table: Table):
    for row in table:
        word = str(row[0])
        match word:
            case "Gauge":
                assert number_of_vowels(word) == 3
            case "Mingle":
                assert number_of_vowels(word) == 2
            case "Snap" | "GoCD":
                assert number_of_vowels(word) == 1
            case "Rhythm":
                assert number_of_vowels(word) == 0
            case _:
                assert False
  1. Run the gauge command
  2. See error

Logs

Failed to parse c:\xxx\gauge_match_case_example\step_impl\step_impl.py: The only possible keyword before an atomtrailers is 'await', not 'match'

Expected behavior
I can use Python 3.10 features like the Structural Pattern Matching.

Versions:

  • Windows 10 Enterprise 21H2
  • Python version 3.10.9
Gauge version: 1.5.4
Commit Hash: 30a0c23

Plugins
-------
html-report (4.2.0)
json-report (0.3.7)
python (0.4.1)
screenshot (0.1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant