#!/usr/bin/env python3

import unittest
import sparse_binary_number


class TestSparseBinaryNumber(unittest.TestCase):

    def setUp(self):
        pass

    def test_bits_0(self):
        self.assertEqual([0], sparse_binary_number.bits(0))

    def test_bits_1(self):
        self.assertEqual([1], sparse_binary_number.bits(0b1))

    def test_bits_3(self):
        self.assertEqual([1, 1], sparse_binary_number.bits(0b11))

    def test_bits_111000101101(self):
        self.assertEqual([1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1],
                         sparse_binary_number.bits(0b111000101101))

    def test_is_sparse_0(self):
        self.assertEqual(True, sparse_binary_number.is_sparse(0))

    def test_is_sparse_0b1(self):
        self.assertEqual(True, sparse_binary_number.is_sparse(0b1))

    def test_is_sparse_0b10(self):
        self.assertEqual(True, sparse_binary_number.is_sparse(0b10))

    def test_is_sparse_0b11(self):
        self.assertEqual(False, sparse_binary_number.is_sparse(0b11))

    # TODO: Consider change test data to a list of tuples
    # test_data = [(0, True), (1, True), (2, True), (3, False) ]


if __name__ == "__main__":
    unittest.main()

@@ -818,13 +818,8 @@
 arse
-_0b10
 (sel
@@ -834,103 +834,367 @@
     
-self.assertEqual(True, sparse_binary_number.is_sparse(0b10))%0A%0A    def test_is_sparse_0b11(self)
+test_data = %5B%0A            (0, True),%0A            (0b1, True),%0A            (0b10, True),%0A            (0b11, False),%0A            (0b100, True),%0A            (0b101, True),%0A            (5, True),%0A            (0b110, False),%0A            (0b1010010010001010001, True),%0A            (0b1100010010001010001, False)%0A        %5D%0A        for (number, expected) in test_data
 :%0A  
@@ -1191,32 +1191,36 @@
 t_data:%0A        
+    
 self.assertEqual
@@ -1220,21 +1220,24 @@
 rtEqual(
-False
+expected
 , sparse
@@ -1265,138 +1265,140 @@
 rse(
-0b11))%0A%0A    # TODO: Consider change test data to a list of tuples%0A    # test_data = %5B(0, True), (1, True), (2, True), (3, False) %5D
+number),%0A                             %22expected %7B0%7D for number 0b%7B1:b%7D%22%0A                             .format(str(expected), number))
 %0A%0A%0Ai

Add test_is_sparse and use test_data list of tuples. Delete separate test_is_sparse_0b10 and test_is_sparse_0b11.