Skip to content

Commit d5e311f

Browse files
authored
Apply suggestions from code review
1 parent cd389f5 commit d5e311f

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

Lib/platform.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,16 +1472,20 @@ def _parse_args(args: list[str] | None):
14721472
parser.add_argument(
14731473
"--terse",
14741474
action="store_true",
1475-
help=("return only the absolute minimum information needed to identify the "
1476-
"platform"),
1475+
help=(
1476+
"return only the absolute minimum information needed "
1477+
"to identify the platform"
1478+
),
14771479
)
14781480
parser.add_argument(
14791481
"--nonaliased",
14801482
dest="aliased",
14811483
action="store_false",
1482-
help=("disable system/OS name aliasing. If aliasing is enabled, "
1483-
"some platforms will report system names which differ from "
1484-
"their common names, e.g. SunOS will be reported as Solaris"),
1484+
help=(
1485+
"disable system/OS name aliasing. If aliasing is enabled, "
1486+
"some platforms report system names different from "
1487+
"their common names, e.g. SunOS is reported as Solaris"
1488+
),
14851489
)
14861490

14871491
return parser.parse_args(args)
@@ -1498,4 +1502,3 @@ def _main(args: list[str] | None = None):
14981502

14991503
if __name__ == "__main__":
15001504
_main()
1501-
sys.exit(0)

Lib/test/test_platform.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -773,27 +773,26 @@ def test_invocation(self):
773773
self.invoke_platform(*combination)
774774

775775
def test_arg_parsing(self):
776-
# Due to backwards compatibility, the `aliased` and `terse` parameters
777-
# are computed based on a combination of positional arguments and flags.
776+
# For backwards compatibility, the `aliased` and `terse` parameters are
777+
# computed based on a combination of positional arguments and flags.
778778
#
779-
# This test tests that the arguments are correctly passed to the underlying
780-
# `platform.platform()` call. The parameters are two booleans for `aliased`
781-
# and `terse`.
779+
# Test that the arguments are correctly passed to the underlying
780+
# `platform.platform()` call.
782781
options = (
783-
(["--nonaliased"], (False, False)),
784-
(["nonaliased"], (False, False)),
785-
(["--terse"], (True, True)),
786-
(["terse"], (True, True)),
787-
(["nonaliased", "terse"], (False, True)),
788-
(["--nonaliased", "terse"], (False, True)),
789-
(["--terse", "nonaliased"], (False, True)),
782+
(["--nonaliased"], False, False),
783+
(["nonaliased"], False, False),
784+
(["--terse"], True, True),
785+
(["terse"], True, True),
786+
(["nonaliased", "terse"], False, True),
787+
(["--nonaliased", "terse"], False, True),
788+
(["--terse", "nonaliased"], False, True),
790789
)
791790

792-
for flags, args in options:
793-
with self.subTest(flags=flags, args=args):
791+
for flags, aliased, terse in options:
792+
with self.subTest(flags=flags, aliased=aliased, terse=terse):
794793
with mock.patch.object(platform, 'platform') as obj:
795794
self.invoke_platform(*flags)
796-
obj.assert_called_once_with(*args)
795+
obj.assert_called_once_with(aliased, terse)
797796

798797
def test_help(self):
799798
output = io.StringIO()

0 commit comments

Comments
 (0)