Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Support later python features such as Python 3.10 feature "Structural Pattern Matching"

未关闭
#324 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
testing

调研方向

Start by reading the Python runner's parsing entry point and checking which parser version it uses; the issue does not name a file or test. Reproduce with the supplied match/case example under Python 3.10, then check whether parsing succeeds. Done means Gauge accepts the example without the reported parse error.

由索引模型根据 Issue 内容生成。

描述

help wanted

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)
主要语言
Python
星标
96
派生
38
平均合并
1 小时 18 分钟
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getgauge/gauge-python 的其他 Issue

查看 getgauge/gauge-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。