def definitions(self): """ return a list of all the definitions that are included in this library """ return ListView(self._definitions)
def libraries(self): """Get a list of all libraries included in the netlist.""" return ListView(self._libraries)
def pins(self): """Get a list of the pins that are in the port""" return ListView(self._pins)
def cables(self): """ Get the cables that are instanced in this definition. """ return ListView(self._cables)
def wires(self): """Gets a list of wires that are in this cable""" return ListView(self._wires)
def children(self): """ Return a list of all instances instantiated in this definition """ return ListView(self._children)
def ports(self): """ Get the ports that are instanced in this definition """ return ListView(self._ports)
def pins(self): """The a list of pins that the wire is connected to""" return ListView(self._pins)
def wires(self): '''get a list of wires that are in this cable''' return ListView(self._wires)
def test_lt(self): self.assertTrue(self.list_view < ListView(list(range(11)))) self.assertTrue(self.list_view < list(range(11)))
def test_le(self): self.assertTrue(self.list_view <= ListView(list(range(10)))) self.assertTrue(self.list_view <= list(range(10)))
def test_gt(self): self.assertTrue(self.list_view > ListView(list(range(9)))) self.assertTrue(self.list_view > list(range(9)))
def setUp(self) -> None: self.list_view = ListView(list(range(10)))
class TestListView(unittest.TestCase): def setUp(self) -> None: self.list_view = ListView(list(range(10))) def test_getitem(self): self.assertTrue(self.list_view[0] == 0) def test_contains(self): self.assertTrue(5 in self.list_view) def test_comparison(self): list_copy = list(range(10)) self.assertEqual(self.list_view, list_copy) empty_list = list() self.assertNotEqual(self.list_view, empty_list) def test_iter(self): aggregate = 0 for item in self.list_view: aggregate += item self.assertEqual(sum(range(10)), aggregate) def test_len(self): self.assertEqual(len(self.list_view), 10) def test_reversed(self): self.assertEqual(next(iter(reversed(self.list_view))), 9) def test_copy(self): self.assertEqual(self.list_view, self.list_view.copy()) def test_count(self): self.assertEqual(self.list_view.count(5), 1) def test_index(self): self.assertEqual(self.list_view.index(5), 5) def test_slice(self): self.assertEqual(self.list_view[1:4], list(range(1, 4))) def test_multiply(self): self.assertEqual(len(self.list_view * 2), 20) self.assertEqual(len(2 * self.list_view), 20) def test_add(self): result = list(range(10, 20)) + self.list_view print(result) self.assertEqual(len(result), 20) result = self.list_view + list(range(10, 20)) print(result) self.assertEqual(len(result), 20) @unittest.expectedFailure def test_multiply_assignment(self): self.list_view *= 2 @unittest.expectedFailure def test_add_assignment(self): self.list_view += list(range(10)) def test_ge(self): self.assertTrue(self.list_view >= ListView(list(range(10)))) self.assertTrue(self.list_view >= list(range(10))) def test_gt(self): self.assertTrue(self.list_view > ListView(list(range(9)))) self.assertTrue(self.list_view > list(range(9))) def test_le(self): self.assertTrue(self.list_view <= ListView(list(range(10)))) self.assertTrue(self.list_view <= list(range(10))) def test_lt(self): self.assertTrue(self.list_view < ListView(list(range(11)))) self.assertTrue(self.list_view < list(range(11))) def test_repr(self): self.assertEqual(repr(self.list_view), repr(list(range(10)))) def test_str(self): self.assertEqual(str(self.list_view), str(list(range(10)))) def test_hash(self): self.assertRaises(TypeError, hash, self.list_view)