Skip to content

Commit

Permalink
linting and formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
valkolovos committed Sep 17, 2024
1 parent 33e3b8d commit a159b47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions examples/tests/v3/basic_flask_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
from typing import Generator, NoReturn

import requests
from flask import Flask, Response, make_response
from yarl import URL

from flask import Flask, Response, make_response

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -95,12 +96,12 @@ def redirect() -> NoReturn:

@app.route("/path/to/<test_id>")
def hello_world(test_id: int) -> Response:
random_regex_matches = "1-8 digits: 12345678, 1-8 random letters abcdefgh"
response = make_response({
"response": {
"id": test_id,
"regexMatches": "must end with 'hello world'",
"randomRegexMatches":
"1-8 digits: 12345678, 1-8 random letters abcdefgh",
"randomRegexMatches": random_regex_matches,
"integerMatches": test_id,
"decimalMatches": round(uniform(0, 9), 3), # noqa: S311
"booleanMatches": True,
Expand Down
8 changes: 4 additions & 4 deletions examples/tests/v3/test_matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_matchers() -> None:
assert (
response_data["response"]["regexMatches"] == "must end with 'hello world'"
)
assert response_data["response"]["integerMatches"] == 42 # noqa: PLR2004
assert response_data["response"]["integerMatches"] == 42
assert response_data["response"]["booleanMatches"] is False
assert response_data["response"]["includeMatches"] == "world"
assert response_data["response"]["dateMatches"] == "2024-01-01"
Expand All @@ -116,12 +116,12 @@ def test_matchers() -> None:
)
random_integer = int(response_data["response"]["randomIntegerMatches"])
assert random_integer >= 1
assert random_integer <= 100 # noqa: PLR2004
assert random_integer <= 100
float(response_data["response"]["randomDecimalMatches"])
assert (
len(response_data["response"]["randomDecimalMatches"].replace(".", "")) == 4 # noqa: PLR2004
len(response_data["response"]["randomDecimalMatches"].replace(".", "")) == 4
)
assert len(response_data["response"]["randomStringMatches"]) == 10 # noqa: PLR2004
assert len(response_data["response"]["randomStringMatches"]) == 10

pact.write_file(pact_dir, overwrite=True)
with start_provider() as url:
Expand Down
1 change: 0 additions & 1 deletion src/pact/v3/matchers/matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"equality",
"regex",
"type",
"type",
"include",
"integer",
"decimal",
Expand Down

0 comments on commit a159b47

Please sign in to comment.