Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

Commit cc9e892

Browse files
committed
Add property "graph_type" to graphs
1 parent 61ff345 commit cc9e892

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pydot_ng/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,8 @@ def get_type(self):
11251125
"""Get the graph's type, 'graph' or 'digraph'."""
11261126
return self.obj_dict['type']
11271127

1128+
graph_type = property(get_type, set_type)
1129+
11281130
def set_name(self, graph_name):
11291131
"""Set the graph's name."""
11301132
self.obj_dict['name'] = graph_name

test/test_pydot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def digraph():
3939
def test_keep_graph_type(graph_type):
4040
graph = pydot.Dot(graph_name="Test", graph_type=graph_type)
4141
assert graph.get_type() == graph_type
42+
assert graph.graph_type == graph_type
4243

4344

4445
def test_node_style():

0 commit comments

Comments
 (0)