예제 #1
0
def test_returntypes(Graph: GameGraph):
    assert isinstance(Graph.as_json(), str)
    assert Graph.truncate_to_roots() == None
    for v in sample(Graph.vertices,
                    k=min(MAX_VERTEX_CHECK, len(Graph.vertices))):
        assert isinstance(Graph.children_at(v, autoexpand=True), tuple)
        assert isinstance(Graph.edges_at(v), set)
        assert isinstance(Graph.equivalenceclass_of(v), set)
        assert isinstance(Graph.representative_of(v), type(v))
        assert isinstance(Graph.score_at(v), float)
        if not Graph.open_at(v):
            assert isinstance(Graph.terminal_at(v), bool)
        assert isinstance(Graph.numpify(v), ndarray)
    assert isinstance(Graph.deepcopy(), Graph.__class__)
예제 #2
0
def test_numpify_unnumpify(Graph: GameGraph):
    for v in Graph.vertices:
        assert Graph.unnumpify(Graph.numpify(v)) == v