本文整理汇总了Python中graphillion.GraphSet.load方法的典型用法代码示例。如果您正苦于以下问题:Python GraphSet.load方法的具体用法?Python GraphSet.load怎么用?Python GraphSet.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphillion.GraphSet
的用法示例。
在下文中一共展示了GraphSet.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_io
# 需要导入模块: from graphillion import GraphSet [as 别名]
# 或者: from graphillion.GraphSet import load [as 别名]
def test_io(self):
gs = GraphSet()
st = gs.dumps()
self.assertEqual(st, "B\n.\n")
gs = GraphSet.loads(st)
self.assertEqual(gs, GraphSet())
gs = GraphSet([g0])
st = gs.dumps()
self.assertEqual(st, "T\n.\n")
gs = GraphSet.loads(st)
self.assertEqual(gs, GraphSet([g0]))
v = [g0, g1, g12, g123, g1234, g134, g14, g4]
gs = GraphSet(v)
st = gs.dumps()
gs = GraphSet.loads(st)
self.assertEqual(gs, GraphSet(v))
# skip this test, becasue string is treated as an element
# gs = GraphSet(st)
# self.assertEqual(gs, GraphSet(v))
with tempfile.TemporaryFile() as f:
gs.dump(f)
f.seek(0)
gs = GraphSet.load(f)
self.assertEqual(gs, GraphSet(v))