From c9a6ea1a9b2813c8850ecfd944177df90a137c65 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 4 Jun 2024 21:19:40 +0200 Subject: [PATCH] test/pybind/rbd: fix tests that compare strings with b'' assert_not_equal(b'', self.image.id()) is bogus because Image::id() returns a string (str), not bytes. If the types don't match, values are guaranteed to not match. The same goes for Image::block_name_prefix(). Signed-off-by: Ilya Dryomov (cherry picked from commit 05f7e4f2025c435dca8ae0b34f65425afbc212b5) --- src/test/pybind/test_rbd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 01ac8b1e538..935e584bd6a 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -627,10 +627,14 @@ class TestImage(object): @require_new_format() def test_id(self): - assert_not_equal(b'', self.image.id()) + id = self.image.id() + assert isinstance(id, str) + assert len(id) > 0 def test_block_name_prefix(self): - assert_not_equal(b'', self.image.block_name_prefix()) + block_name_prefix = self.image.block_name_prefix() + assert isinstance(block_name_prefix, str) + assert len(block_name_prefix) > 0 def test_data_pool_id(self): assert_greater_equal(self.image.data_pool_id(), 0) -- 2.39.5