From bf3724a495babb639449ce3ca8d7301ebf115589 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Wed, 15 May 2024 14:59:17 -0400 Subject: [PATCH] Fix bit count function --- src/python_testing/TC_ICDM_2_1.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index c97b14ae3e1af7..6af092a4ed5116 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -63,8 +63,9 @@ def is_valid_uint16_value(var): def is_valid_uint8_value(var): return isinstance(var, int) and 0 <= var <= 0xFF - def bit_count(self): - return bin(self).count("1") + @staticmethod + def set_bits_count(number): + return bin(number).count("1") async def _read_icdm_attribute_expect_success(self, attribute): return await self.read_single_attribute_check_success(endpoint=kRootEndpointId, cluster=cluster, attribute=attribute) @@ -213,8 +214,8 @@ async def test_TC_ICDM_2_1(self): uatHintInstructionDepedentBitmap = uat( userActiveModeTriggerHint) & kUatInstructionDependentBitMask - asserts.assert_less_equal( - uatHintInstructionDepedentBitmap.bit_count(), 1, "UserActiveModeTriggerHint has more than 1 bit that is dependent on the UserActiveModeTriggerInstruction") + asserts.assert_less_equal( + self.set_bits_count(uatHintInstructionDepedentBitmap), 1, "UserActiveModeTriggerHint has more than 1 bit that is dependent on the UserActiveModeTriggerInstruction") # Valdate UserActiveModeTriggerInstruction self.step(9)