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

test: unexpected warning showed during test #46

Open
l7wei opened this issue Dec 12, 2023 · 2 comments
Open

test: unexpected warning showed during test #46

l7wei opened this issue Dec 12, 2023 · 2 comments
Assignees
Labels
bug Related to a bug

Comments

@l7wei
Copy link
Member

l7wei commented Dec 12, 2023

Some unexpected warning showed during test.

/home/runner/work/NTHU-Data-API/NTHU-Data-API/src/api/models/buses.py:162: SyntaxWarning: invalid escape sequence '\{'
  regex_pattern = r"const " + variable_string + " = (\{.*?\})"
/home/runner/work/NTHU-Data-API/NTHU-Data-API/src/api/models/buses.py:180: SyntaxWarning: invalid escape sequence '\['
  regex_pattern = r"const " + variable_string + " = (\[.*?\])"
<unknown>:162: SyntaxWarning: invalid escape sequence '\{'
<unknown>:180: SyntaxWarning: invalid escape sequence '\['
/home/runner/work/NTHU-Data-API/NTHU-Data-API/src/api/models/buses.py:162: SyntaxWarning: invalid escape sequence '\{'
  regex_pattern = r"const " + variable_string + " = (\{.*?\})"
/home/runner/work/NTHU-Data-API/NTHU-Data-API/src/api/models/buses.py:180: SyntaxWarning: invalid escape sequence '\['
  regex_pattern = r"const " + variable_string + " = (\[.*?\])"
DeprecationWarning: `example` has been deprecated, please use `examples` instead
@l7wei l7wei added the bug Related to a bug label Dec 12, 2023
@l7wei l7wei changed the title test: warning showed during test test: unexpected warning showed during test Dec 12, 2023
iwtba4188 added a commit to iwtba4188/NTHU-Data-API that referenced this issue Dec 12, 2023
iwtba4188 added a commit to iwtba4188/NTHU-Data-API that referenced this issue Dec 12, 2023
iwtba4188 added a commit to iwtba4188/NTHU-Data-API that referenced this issue Dec 12, 2023
@iwtba4188
Copy link
Contributor

DeprecationWarning: `example` has been deprecated, please use `examples` instead
  • 雖然 example 已經被棄用了,但感覺是最符合目前情況的用法,因為它會精簡的顯示在欄位上:
    螢幕擷取畫面 2023-12-13 023645

  • 新的 examples 會在 openapi.json 做更恰當的註記,但 Swagger UI 並不會顯示出來:
    螢幕擷取畫面 2023-12-13 023344

(略)
        "/buses/stops/{stop_name}/{bus_type}/{day}/{direction}": {
            "get": {
                "tags": [
                    "Buses"
                ],
                "summary": "Get Stop Up",
                "description": "取得公車站牌停靠公車資訊。",
                "operationId": "get_stop_up_buses_stops__stop_name___bus_type___day___direction__get",
                "parameters": [
                    {
                        "name": "stop_name",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/StopsName"
                                }
                            ],
                            "description": "公車站牌名稱",
                            "examples": [
                                "台積館"
                            ],
                            "title": "Stop Name"
                        },
                        "description": "公車站牌名稱"
                    },
(略)
  • 而使用可正常顯示的參數 openapi_examples 又顯得下拉式選單過於冗餘,因為多數情況下範例只會有一個:
    螢幕擷取畫面 2023-12-13 024114

  • fastapi 的作者也有就這個議題做過回應:ref

l7wei pushed a commit that referenced this issue Dec 12, 2023
* fix(smokeshow): fix cov report path

* fix(buses): invalid escape sequence in regex (fixed partial #46)
@iwtba4188
Copy link
Contributor

btw, 如果想要眼不見為淨的話可以加上 -W ignore::DeprecationWarning 世界就安靜ㄌ
ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants