gh-131236: allow to generate multiple UUIDs at once via CLI (#131218)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Simon Legner 2025-03-26 21:49:28 +01:00 committed by GitHub
parent 4b3d5b6042
commit 52b5eb95b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 16 deletions

View file

@ -1166,6 +1166,20 @@ class BaseTestUUID:
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 4)
@mock.patch.object(sys, "argv", ["", "-C", "3"])
def test_cli_uuid4_outputted_with_count(self):
stdout = io.StringIO()
with contextlib.redirect_stdout(stdout):
self.uuid.main()
output = stdout.getvalue().strip().splitlines()
# Check that 3 UUIDs in the format of uuid4 have been generated
self.assertEqual(len(output), 3)
for o in output:
uuid_output = self.uuid.UUID(o)
self.assertEqual(uuid_output.version, 4)
@mock.patch.object(sys, "argv",
["", "-u", "uuid3", "-n", "@dns", "-N", "python.org"])
def test_cli_uuid3_ouputted_with_valid_namespace_and_name(self):