Skip to content

Commit

Permalink
session/test_env_select: Reformat from tox -e fix
Browse files Browse the repository at this point in the history
I find this makes the tests significantly less readable, so I'm commiting
this separately so we can decide what to do about it. The options are:

1. Squash this with the previous, just using the auto-enforced formatting.
2. Leave these commits as-is, so we at least can go back to the more
   readable original formatting.
3. Do whatever needs to be done to keep the auto-reformatter from touching
   that particular bit of code.

I have a preference for 3, but won't argue any other decision.
  • Loading branch information
0cjs committed Jan 26, 2024
1 parent 485141a commit 371cb60
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions tests/session/test_env_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,26 @@


@pytest.mark.parametrize(
("userinput", "envnames", "isall", "isdefault" ), [
(None, (), False, True ),
("", (), False, True ),
("a1", ("a1",), False, False ),
("a1,b2,c3", ("a1", "b2", "c3"), False, False ),
# If the user gives "ALL" as any envname, this becomes an "is_all" and other envnames are ignored.
("ALL", (), True, False ),
("a1,ALL,b2", (), True, False ),
# Zero-length envnames are ignored as being not present. This is not intentional.
(",,a1,,,b2,,", ("a1", "b2"), False, False ),
(",,", (), False, True ),
# Environment names with "invalid" characters are accepted here; the client is expected to deal with this.
("\x01.-@\x02,xxx", ("\x01.-@\x02", "xxx"), False, False ),
("userinput", "envnames", "isall", "isdefault"),
[
(None, (), False, True),
("", (), False, True),
("a1", ("a1",), False, False),
("a1,b2,c3", ("a1", "b2", "c3"), False, False),
# If the user gives "ALL" as any envname, this becomes an "is_all" and other envnames are ignored.
("ALL", (), True, False),
("a1,ALL,b2", (), True, False),
# Zero-length envnames are ignored as being not present. This is not intentional.
(",,a1,,,b2,,", ("a1", "b2"), False, False),
(",,", (), False, True),
# Environment names with "invalid" characters are accepted here; the client is expected to deal with this.
("\x01.-@\x02,xxx", ("\x01.-@\x02", "xxx"), False, False),
],
)
def test_clienv(userinput: str, envnames: tuple[str], isall: bool, isdefault: bool) -> None:
c = CliEnv(userinput)
assert (c.is_all, c.is_default_list, tuple(c)) \
== (isall, isdefault, tuple(envnames))
assert (c.is_all, c.is_default_list, tuple(c)) == (isall, isdefault, tuple(envnames))


@pytest.mark.parametrize(
("userinput", "expected"),
Expand Down

0 comments on commit 371cb60

Please sign in to comment.