forked from fastapi/typer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove email-validator from examples/testing dependencies
Fixes fastapi#181
- Loading branch information
Showing
15 changed files
with
75 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import typer | ||
from pydantic import EmailStr | ||
from pydantic import AnyHttpUrl | ||
from typing_extensions import Annotated | ||
|
||
|
||
def main(email_opt: Annotated[EmailStr, typer.Option()] = "[email protected]"): | ||
typer.echo(f"email_opt: {email_opt}") | ||
def main(url_opt: Annotated[AnyHttpUrl, typer.Option()] = "[email protected]"): | ||
typer.echo(f"url_opt: {url_opt}") | ||
|
||
|
||
if __name__ == "__main__": | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,22 +18,25 @@ def test_help(): | |
|
||
|
||
def test_tuple(): | ||
result = runner.invoke( | ||
app, ["--user", "Camila", "23", "[email protected]", "https://example.com"] | ||
) | ||
result = runner.invoke(app, ["--server", "Example", "::1", "https://example.com"]) | ||
assert result.exit_code == 0 | ||
assert "name: Camila" in result.output | ||
assert "age: 23" in result.output | ||
assert "email: [email protected]" in result.output | ||
assert "name: Example" in result.output | ||
assert "address: ::1" in result.output | ||
assert "url: https://example.com" in result.output | ||
|
||
|
||
def test_tuple_invalid(): | ||
def test_tuple_invalid_ip(): | ||
result = runner.invoke( | ||
app, ["--user", "Camila", "23", "invalid", "https://example.com"] | ||
app, ["--server", "Invalid", "invalid", "https://example.com"] | ||
) | ||
assert result.exit_code != 0 | ||
assert "value is not a valid email address" in result.output | ||
assert "value is not a valid IPv4 or IPv6 address" in result.output | ||
|
||
|
||
def test_tuple_invalid_url(): | ||
result = runner.invoke(app, ["--server", "Invalid", "::1", "invalid"]) | ||
assert result.exit_code != 0 | ||
assert "Input should be a valid URL" in result.output | ||
|
||
|
||
def test_script(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,22 +18,25 @@ def test_help(): | |
|
||
|
||
def test_tuple(): | ||
result = runner.invoke( | ||
app, ["--user", "Camila", "23", "[email protected]", "https://example.com"] | ||
) | ||
result = runner.invoke(app, ["--server", "Example", "::1", "https://example.com"]) | ||
assert result.exit_code == 0 | ||
assert "name: Camila" in result.output | ||
assert "age: 23" in result.output | ||
assert "email: [email protected]" in result.output | ||
assert "name: Example" in result.output | ||
assert "address: ::1" in result.output | ||
assert "url: https://example.com" in result.output | ||
|
||
|
||
def test_tuple_invalid(): | ||
def test_tuple_invalid_ip(): | ||
result = runner.invoke( | ||
app, ["--user", "Camila", "23", "invalid", "https://example.com"] | ||
app, ["--server", "Invalid", "invalid", "https://example.com"] | ||
) | ||
assert result.exit_code != 0 | ||
assert "value is not a valid email address" in result.output | ||
assert "value is not a valid IPv4 or IPv6 address" in result.output | ||
|
||
|
||
def test_tuple_invalid_url(): | ||
result = runner.invoke(app, ["--server", "Invalid", "::1", "invalid"]) | ||
assert result.exit_code != 0 | ||
assert "Input should be a valid URL" in result.output | ||
|
||
|
||
def test_script(): | ||
|