From 1365e21ab9f13597d7fdb4feb0825453f32cae4b Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Wed, 8 Feb 2023 19:51:54 +0100 Subject: ucid from buffer and bytes --- test/utils/test_uuid.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/utils/test_uuid.py b/test/utils/test_uuid.py index 0de96ed..804b063 100644 --- a/test/utils/test_uuid.py +++ b/test/utils/test_uuid.py @@ -83,6 +83,16 @@ class TestUCID(unittest.TestCase): def test_from_path(self): self.assertEqual(UCID.from_path(self._path), self._checksum) + def test_from_buffer(self): + with open(self._path, 'rb') as ifile: + self.assertEqual(UCID.from_buffer(ifile), self._checksum) + with open(self._path) as ifile: + self.assertEqual(UCID.from_buffer(ifile), self._checksum) + + def test_from_bytes(self): + with open(self._path, 'rb') as ifile: + self.assertEqual(UCID.from_bytes(ifile.read()), self._checksum) + def test_from_dict(self): self.assertEqual(UCID.from_dict({'hello': 'world', 'foo': 1234, 'bar': False}), '8d2544395a0d2827e3d9ce8cd619d5e3f801e8126bf3f93ee5abd38158959585') -- cgit v1.2.3