def test_get_op_len(self): """Test that op len enables bus methods to operate on both a length and a Bus""" b = Bus(1, 1) b2 = Bus(4) branched = b.branch(4) self.assertEqual(len(branched), 4) branched = b.branch(b2) self.assertEqual(len(branched), 4)
def test_branch(self): """Test branching feature""" a = Bus(1) branched_a = a.branch(4) self.assertEqual(len(branched_a), 4) self.assertEqual(branched_a.signal, Signal(0, 4)) a.signal = 1 self.assertEqual(branched_a.signal, Signal(2**4 - 1, 4))