Content-Length: 311376 | pFad | http://github.com/python/cpython/pull/136548/commits/609ab56fbabcfabd4b1e1368f1a104b309a07c50

8D gh-89083: Add CLI tests for `UUIDv{6,7,8}` by LamentXU123 · Pull Request #136548 · python/cpython · GitHub
Skip to content

gh-89083: Add CLI tests for UUIDv{6,7,8} #136548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 12, 2025
Next Next commit
Update test_uuid.py
  • Loading branch information
LamentXU123 authored Jul 11, 2025
commit 609ab56fbabcfabd4b1e1368f1a104b309a07c50
58 changes: 58 additions & 0 deletions Lib/test/test_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,64 @@ def test_cli_uuid5_ouputted_with_valid_namespace_and_name(self):
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 5)

@mock.patch.object(sys, "argv",
["", "-u", "uuid1"])
def test_cli_uuid1(self):
stdout = io.StringIO()
with contextlib.redirect_stdout(stdout):
self.uuid.main()

output = stdout.getvalue().strip()
uuid_output = self.uuid.UUID(output)

# Output should be in the form of uuid1
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 1)


@mock.patch.object(sys, "argv",
["", "-u", "uuid6"])
def test_cli_uuid6(self):
stdout = io.StringIO()
with contextlib.redirect_stdout(stdout):
self.uuid.main()

output = stdout.getvalue().strip()
uuid_output = self.uuid.UUID(output)

# Output should be in the form of uuid6
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 6)


@mock.patch.object(sys, "argv",
["", "-u", "uuid7"])
def test_cli_uuid7(self):
stdout = io.StringIO()
with contextlib.redirect_stdout(stdout):
self.uuid.main()

output = stdout.getvalue().strip()
uuid_output = self.uuid.UUID(output)

# Output should be in the form of uuid7
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 7)


@mock.patch.object(sys, "argv",
["", "-u", "uuid8"])
def test_cli_uuid8(self):
stdout = io.StringIO()
with contextlib.redirect_stdout(stdout):
self.uuid.main()

output = stdout.getvalue().strip()
uuid_output = self.uuid.UUID(output)

# Output should be in the form of uuid8
self.assertEqual(output, str(uuid_output))
self.assertEqual(uuid_output.version, 8)

class TestUUIDWithoutExtModule(BaseTestUUID, unittest.TestCase):
uuid = py_uuid
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/136548/commits/609ab56fbabcfabd4b1e1368f1a104b309a07c50

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy