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

Add test for Literal #72

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pydantic_cli/examples/simple_with_custom.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import logging
from typing import Union
from typing import Union, Literal

from pydantic import Field

Expand All @@ -17,6 +17,7 @@ class Options(Cmd):
max_records: int = Field(10, cli=("-m", "--max-records"))
min_filter_score: float = Field(..., cli=("-f", "--filter-score"))
alpha: Union[int, str] = 1
beta: Literal["a", "b"] = "a"

def run(self) -> None:
log.info(
Expand Down
2 changes: 1 addition & 1 deletion pydantic_cli/tests/test_examples_simple_with_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def test_simple_01(self):
self.run_config(["-i", "/path/to/file.txt", "-f", "1.0", "-m", "2"])

def test_simple_02(self):
self.run_config(["-i", "/path/to/file.txt", "-f", "1.0"])
self.run_config(["-i", "/path/to/file.txt", "-f", "1.0", "--beta", "b"])
Loading