Exemple #1
0
    def test_comparison(self):
        gs = GraphSet([g12])
        self.assertEqual(gs, GraphSet([g12]))
        self.assertNotEqual(gs, GraphSet([g13]))

        # __nonzero__
        self.assertTrue(gs)
        self.assertFalse(GraphSet())

        v = [g0, g12, g13]
        gs = GraphSet(v)
        self.assertTrue(gs.isdisjoint(GraphSet([g1, g123])))
        self.assertFalse(gs.isdisjoint(GraphSet([g1, g12])))

        self.assertTrue(gs.issubset(GraphSet(v)))
        self.assertFalse(gs.issubset(GraphSet([g0, g12])))
        self.assertTrue(gs <= GraphSet(v))
        self.assertFalse(gs <= GraphSet([g0, g12]))
        self.assertTrue(gs < GraphSet([g0, g1, g12, g13]))
        self.assertFalse(gs < GraphSet(v))

        self.assertTrue(gs.issuperset(GraphSet(v)))
        self.assertFalse(gs.issuperset(GraphSet([g1, g12])))
        self.assertTrue(gs >= GraphSet(v))
        self.assertFalse(gs >= GraphSet([g1, g12]))
        self.assertTrue(gs > GraphSet([[], g12]))
        self.assertFalse(gs > GraphSet(v))
Exemple #2
0
    def test_comparison(self):
        gs = GraphSet([g12])
        self.assertEqual(gs, GraphSet([g12]))
        self.assertNotEqual(gs, GraphSet([g13]))

        # __nonzero__
        self.assertTrue(gs)
        self.assertFalse(GraphSet())

        v = [g0, g12, g13]
        gs = GraphSet(v)
        self.assertTrue(gs.isdisjoint(GraphSet([g1, g123])))
        self.assertFalse(gs.isdisjoint(GraphSet([g1, g12])))

        self.assertTrue(gs.issubset(GraphSet(v)))
        self.assertFalse(gs.issubset(GraphSet([g0, g12])))
        self.assertTrue(gs <= GraphSet(v))
        self.assertFalse(gs <= GraphSet([g0, g12]))
        self.assertTrue(gs < GraphSet([g0, g1, g12, g13]))
        self.assertFalse(gs < GraphSet(v))

        self.assertTrue(gs.issuperset(GraphSet(v)))
        self.assertFalse(gs.issuperset(GraphSet([g1, g12])))
        self.assertTrue(gs >= GraphSet(v))
        self.assertFalse(gs >= GraphSet([g1, g12]))
        self.assertTrue(gs > GraphSet([[], g12]))
        self.assertFalse(gs > GraphSet(v))