Exemplo n.º 1
0
    def test_recorrerMyTree(self):
        myTree = MBTree(10)

        for i in range(11, 13):
            myTree.insert(i)

        self.assertEqual(recorrer_iterable(myTree), [10, 11, 12])
Exemplo n.º 2
0
    def test_recorrerMyTreeUnsorted(self):
        myTree = MBTree(10)

        myTree.insert(1)
        myTree.insert(12)
        myTree.insert(140)

        self.assertEqual(recorrer_iterable(myTree), [1, 10, 12, 140])
Exemplo n.º 3
0
    def test_recorrerMyTreeString(self):
        myTree = MBTree("A")

        myTree.insert("B")
        myTree.insert("C")
        myTree.insert("D")
        myTree.insert("E")

        self.assertEqual(recorrer_iterable(myTree), ["A", "B", "C", "D", "E"])
Exemplo n.º 4
0
 def test_NoInterfaceAvailable(self):
     with self.assertRaisesWithMessage(ValueError):
         recorrer_iterable(1)
Exemplo n.º 5
0
    def test_recorrerMyRangeEmpty(self):
        myRange = MRange()

        self.assertEqual(recorrer_iterable(myRange),
                         [i for i in range(0, 100)])
Exemplo n.º 6
0
    def test_recorrerMyRange(self):
        myRange = MRange(start=1, stop=6)

        self.assertEqual(recorrer_iterable(myRange), [1, 2, 3, 4, 5])
Exemplo n.º 7
0
    def test_recorrerMyTreeEmpty(self):
        myTree = MBTree()

        self.assertEqual(recorrer_iterable(myTree), [None])
Exemplo n.º 8
0
    def test_recorrerMyTreeOnlyRoot(self):
        myTree = MBTree(10)

        self.assertEqual(recorrer_iterable(myTree), [10])