Skip to content

Commit

Permalink
Merge pull request #72 from mpkocher/add-literal-test
Browse files Browse the repository at this point in the history
Add test for Literal
  • Loading branch information
mpkocher authored Sep 20, 2024
2 parents b343dc3 + fe54da1 commit f4019b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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"])

0 comments on commit f4019b4

Please sign in to comment.