Esempio n. 1
0
    def test_heap_post_push_unorderable_not_broken(self):
        heap = Heap([1, 2, 3])
        try:
            heap.push([])
        except ValueError:
            pass
        else:
            pass

        for x in popper(heap):
            pass  # this should run fine and not see that list or Python 2 won't care
Esempio n. 2
0
    def test_heap_post_push_unorderable_not_broken(self):
        heap = Heap([1, 2, 3])
        try:
            heap.push([])
        except ValueError:
            pass
        else:
            pass

        for x in popper(heap):
            pass  # this should run fine and not see that list or Python 2 won't care
Esempio n. 3
0
    def test_heap_complain_unorderable(self):
        if sys.version_info < (3,):
            raise unittest.SkipTest("Python 2 happily compares disparate types.")

        heap = Heap([1, 2, 3])
        try:
            heap.push([])
        except ValueError as e:
            self.assertIn("order", str(e))
        else:
            self.fail("allowed insertion of unorderable type")
Esempio n. 4
0
    def test_heap_complain_unorderable(self):
        if sys.version_info < (3, ):
            raise unittest.SkipTest(
                "Python 2 happily compares disparate types.")

        heap = Heap([1, 2, 3])
        try:
            heap.push([])
        except ValueError as e:
            self.assertIn("order", str(e))
        else:
            self.fail("allowed insertion of unorderable type")