Skip to content

Commit

Permalink
Python 3.11 test + coverage fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Jan 14, 2024
1 parent caf7bdb commit 9553886
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DefaultInstanceSubparser:
# bc: Union[DefaultInstanceHTTPServer, DefaultInstanceSMTPServer]
bc: tyro.conf.Suppress[
Union[DefaultInstanceHTTPServer, DefaultInstanceSMTPServer]
] = DefaultInstanceHTTPServer()
] = dataclasses.field(default_factory=DefaultInstanceHTTPServer)

assert "bc" not in get_helptext(DefaultInstanceSubparser)

Expand Down Expand Up @@ -517,6 +517,19 @@ def main(x: Any = Struct()):
assert "--x.b" not in helptext


def test_suppress_manual_fixed_one_arg_only() -> None:
@dataclasses.dataclass
class Struct:
b: tyro.conf.SuppressFixed[tyro.conf.Fixed[str]] = "7"

def main(x: Any = Struct()):
pass

helptext = get_helptext(main)
assert "--x.a" not in helptext
assert "--x.b" not in helptext


def test_suppress_auto_fixed() -> None:
@dataclasses.dataclass
class Struct:
Expand Down

0 comments on commit 9553886

Please sign in to comment.