コード例 #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])
コード例 #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])
コード例 #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"])
コード例 #4
0
 def test_NoInterfaceAvailable(self):
     with self.assertRaisesWithMessage(ValueError):
         recorrer_iterable(1)
コード例 #5
0
    def test_recorrerMyRangeEmpty(self):
        myRange = MRange()

        self.assertEqual(recorrer_iterable(myRange),
                         [i for i in range(0, 100)])
コード例 #6
0
    def test_recorrerMyRange(self):
        myRange = MRange(start=1, stop=6)

        self.assertEqual(recorrer_iterable(myRange), [1, 2, 3, 4, 5])
コード例 #7
0
    def test_recorrerMyTreeEmpty(self):
        myTree = MBTree()

        self.assertEqual(recorrer_iterable(myTree), [None])
コード例 #8
0
    def test_recorrerMyTreeOnlyRoot(self):
        myTree = MBTree(10)

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