i really hate f"....". replace with just bin(v) and add a comment
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Aug 2022 09:43:11 +0000 (10:43 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Aug 2022 09:43:11 +0000 (10:43 +0100)
src/nmutil/test/test_prefix_sum.py

index cef9da1c2d927ec144fbf1571add1f607aa75212..48598b88697b286e2a6f879f0e185aadbb58dc6e 100644 (file)
@@ -70,7 +70,7 @@ class TestPrefixSum(FHDLTestCase):
     def tst_pop_count_int(self, width):
         assert isinstance(width, int)
         for v in range(1 << width):
-            expected = f"{v:b}".count("1")
+            expected = bin(v).count("1") # converts to a string, counts 1s
             with self.subTest(v=v, expected=expected):
                 self.assertEqual(expected, pop_count(v, width=width))