def test_large(self): n = 1000 setset.set_universe(range(n)) ss = setset({}) - setset([set([1]), set([1, 2])]) self.assertTrue(ss) self.assertEqual(ss.len(), 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069374) i = 0 for s in ss: if i > 100: break i += 1
def test_large(self): n = 1000 setset.set_universe(range(n)) ss = setset({}) - setset([set([1]), set([1, 2])]) self.assertTrue(ss) self.assertEqual( ss.len(), 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069374 ) i = 0 for s in ss: if i > 100: break i += 1
def test_init(self): import _graphillion self.assertEqual(_graphillion._elem_limit(), 2**20 - 1) setset.set_universe([]) self.assertEqual(setset._obj2int, {}) self.assertEqual(setset._int2obj, [None]) self.assertEqual(setset.universe(), []) setset.set_universe(['i', 'ii']) self.assertEqual(setset._obj2int, {'i': 1, 'ii': 2}) self.assertEqual(setset._int2obj, [None, 'i', 'ii']) self.assertEqual(setset.universe(), ['i', 'ii']) ss = setset({}) self.assertEqual( ss, setset([set(), set(['i']), set(['i', 'ii']), set(['ii'])])) setset.set_universe(['1']) self.assertEqual(setset._obj2int, {'1': 1}) self.assertEqual(setset._int2obj, [None, '1']) self.assertEqual(setset.universe(), ['1']) ss = setset({}) self.assertEqual(ss, setset([s0, s1])) self.assertRaises(ValueError, setset.set_universe, ['1', '1'])
def test_init(self): setset.set_universe([]) self.assertEqual(setset._obj2int, {}) self.assertEqual(setset._int2obj, [None]) self.assertEqual(setset.universe(), []) setset.set_universe(['i', 'ii']) self.assertEqual(setset._obj2int, {'i': 1, 'ii': 2}) self.assertEqual(setset._int2obj, [None, 'i', 'ii']) self.assertEqual(setset.universe(), ['i', 'ii']) ss = setset({}) self.assertEqual( ss, setset([set(), set(['i']), set(['i', 'ii']), set(['ii'])])) setset.set_universe(['1']) self.assertEqual(setset._obj2int, {'1': 1}) self.assertEqual(setset._int2obj, [None, '1']) self.assertEqual(setset.universe(), ['1']) ss = setset({}) self.assertEqual(ss, setset([s0, s1])) self.assertRaises(ValueError, setset.set_universe, ['1', '1'])
def test_init(self): import _graphillion self.assertEqual(_graphillion._elem_limit(), 2**20 - 1) setset.set_universe([]) self.assertEqual(setset._obj2int, {}) self.assertEqual(setset._int2obj, [None]) self.assertEqual(setset.universe(), []) setset.set_universe(['i', 'ii']) self.assertEqual(setset._obj2int, {'i': 1, 'ii': 2}) self.assertEqual(setset._int2obj, [None, 'i', 'ii']) self.assertEqual(setset.universe(), ['i', 'ii']) ss = setset({}) self.assertEqual( ss, setset([set(), set(['i']), set(['i','ii']), set(['ii'])])) setset.set_universe(['1']) self.assertEqual(setset._obj2int, {'1': 1}) self.assertEqual(setset._int2obj, [None, '1']) self.assertEqual(setset.universe(), ['1']) ss = setset({}) self.assertEqual(ss, setset([s0, s1])) self.assertRaises(ValueError, setset.set_universe, ['1', '1'])
def test_init(self): setset.set_universe([]) self.assertEqual(setset._obj2int, {}) self.assertEqual(setset._int2obj, [None]) self.assertEqual(setset.universe(), []) setset.set_universe(['i', 'ii']) self.assertEqual(setset._obj2int, {'i': 1, 'ii': 2}) self.assertEqual(setset._int2obj, [None, 'i', 'ii']) self.assertEqual(setset.universe(), ['i', 'ii']) ss = setset({}) self.assertEqual( ss, setset([set(), set(['i']), set(['i','ii']), set(['ii'])])) setset.set_universe(['1']) self.assertEqual(setset._obj2int, {'1': 1}) self.assertEqual(setset._int2obj, [None, '1']) self.assertEqual(setset.universe(), ['1']) ss = setset({}) self.assertEqual(ss, setset([s0, s1])) self.assertRaises(ValueError, setset.set_universe, ['1', '1'])
def setUp(self): setset.set_universe(['1', '2', '3', '4'])