Beispiel #1
0
    def test_popleft(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_front()

        self.assertEquals(item[1], v)
        self.assertEquals(lht._first.value, v2)
        self.assertEquals(lht._last.value, v4)
        self.assertEquals(len(lht), 3)
Beispiel #2
0
 def test_popleft_empty(self):
     lht = LinkedHashTable()
     self.assertEquals(None, lht.pop_front()[1])