Skip to content

Commit f4019b4

Browse files
authored
Merge pull request #72 from mpkocher/add-literal-test
Add test for Literal
2 parents b343dc3 + fe54da1 commit f4019b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pydantic_cli/examples/simple_with_custom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
import logging
3-
from typing import Union
3+
from typing import Union, Literal
44

55
from pydantic import Field
66

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

2122
def run(self) -> None:
2223
log.info(

pydantic_cli/tests/test_examples_simple_with_custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ def test_simple_01(self):
1010
self.run_config(["-i", "/path/to/file.txt", "-f", "1.0", "-m", "2"])
1111

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

0 commit comments

Comments
 (0)