mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
4b3d5b6042
commit
52b5eb95b7
5 changed files with 49 additions and 16 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue