def test_consecutives_allowed_across_empties(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')

        q.put(e1)
        q.put(e1)       # repeat the first entry (this shouldn't get added)

        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())

        q.put(e1)       # this repeat is allowed because 'last' added is now gone from queue
        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())
Esempio n. 2
0
def test_consecutives_allowed_across_empties():
    q = SkipRepeatsQueue()

    e1 = (2, 'fred')

    q.put(e1)
    q.put(e1)   # repeat the first entry (this shouldn't get added)

    assert e1 == q.get()
    assert q.empty()

    q.put(e1)  # this repeat is allowed because 'last' added is now gone from queue
    assert e1 == q.get()
    assert q.empty()
Esempio n. 3
0
    def test_consecutives_allowed_across_empties(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')

        q.put(e1)
        q.put(e1)  # repeat the first entry (this shouldn't get added)

        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())

        q.put(
            e1
        )  # this repeat is allowed because 'last' added is now gone from queue
        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())
Esempio n. 4
0
    def test_prevent_consecutive(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')

        q.put(e1)
        q.put(e1)  # repeat the first entry (this shouldn't get added)
        q.put(e2)

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertTrue(q.empty())
    def test_prevent_consecutive(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')

        q.put(e1)
        q.put(e1)       # repeat the first entry (this shouldn't get added)
        q.put(e2)

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertTrue(q.empty())
Esempio n. 6
0
def test_prevent_consecutive():
    q = SkipRepeatsQueue()

    e1 = (2, 'fred')
    e2 = (2, 'george')

    q.put(e1)
    q.put(e1)  # repeat the first entry (this shouldn't get added)
    q.put(e2)

    assert e1 == q.get()
    assert e2 == q.get()
    assert q.empty()
Esempio n. 7
0
    def test_allow_nonconsecutive(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')

        q.put(e1)
        q.put(e2)
        q.put(e1)  # repeat the first entry

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())
    def test_allow_nonconsecutive(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')

        q.put(e1)
        q.put(e2)
        q.put(e1)       # repeat the first entry

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertEqual(e1, q.get())
        self.assertTrue(q.empty())
Esempio n. 9
0
def test_allow_nonconsecutive():
    q = SkipRepeatsQueue()

    e1 = (2, 'fred')
    e2 = (2, 'george')

    q.put(e1)
    q.put(e2)
    q.put(e1)  # repeat the first entry

    assert e1 == q.get()
    assert e2 == q.get()
    assert e1 == q.get()
    assert q.empty()
Esempio n. 10
0
def test_allow_nonconsecutive():
    q = SkipRepeatsQueue()

    e1 = (2, 'fred')
    e2 = (2, 'george')

    q.put(e1)
    q.put(e2)
    q.put(e1)  # repeat the first entry

    assert e1 == q.get()
    assert e2 == q.get()
    # assert e1 == q.get() modified for OrderedSet queue implementation
    assert q.empty()
Esempio n. 11
0
    def test_basic_queue(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')
        e3 = (4, 'sally')

        q.put(e1)
        q.put(e2)
        q.put(e3)

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertEqual(e3, q.get())
        self.assertTrue(q.empty())
    def test_basic_queue(self):
        q = SkipRepeatsQueue()

        e1 = (2, 'fred')
        e2 = (2, 'george')
        e3 = (4, 'sally')

        q.put(e1)
        q.put(e2)
        q.put(e3)

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertEqual(e3, q.get())
        self.assertTrue(q.empty())
Esempio n. 13
0
def basic_actions():
    q = SkipRepeatsQueue()

    e1 = (2, 'fred')
    e2 = (2, 'george')
    e3 = (4, 'sally')

    q.put(e1)
    q.put(e2)
    q.put(e3)

    assert e1 == q.get()
    assert e2 == q.get()
    assert e3 == q.get()
    assert q.empty()
Esempio n. 14
0
    def test_basic_queue(self):
        q = SkipRepeatsQueue()

        e1 = (2, "fred")
        e2 = (2, "george")
        e3 = (4, "sally")

        q.put(e1)
        q.put(e2)
        q.put(e3)

        self.assertEqual(e1, q.get())
        self.assertEqual(e2, q.get())
        self.assertEqual(e3, q.get())
        self.assertTrue(q.empty())