Esempio n. 1
0
    def test_pop(self):
        lht = LinkedHashTable()

        k, v = 'some key', b'a thicc value'
        k2, v2 = 'another key', b'a thiccer value'
        k3, v3 = 'anotha one!', b'a thiccest value'
        k4, v4 = 'yet another one', b'a thiccerest value'
        lht.append(k, v)
        lht.append(k2, v2)
        lht.append(k3, v3)
        lht.append(k4, v4)

        item = lht.pop_back()

        self.assertEquals(item[1], v4)
        self.assertEquals(lht._last.value, v3)
        self.assertEquals(lht._first.value, v)
        self.assertEquals(len(lht), 3)
Esempio n. 2
0
 def test_pop_empty(self):
     lht = LinkedHashTable()
     self.assertEquals(None, lht.pop_back())