python: implement twa_graph.__copy__

Fixes #470, suggested by Cambridge Yang.

* python/spot/__init__.py (twa_graph.__copy__): Call make_twa_graph.
* tests/python/twagraph.py: Test it.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2021-07-08 09:33:57 +02:00
parent 0509263f82
commit 0cf2d285b6
3 changed files with 16 additions and 3 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2020 Laboratoire de
# Copyright (C) 2014-2021 Laboratoire de
# Recherche et Développement de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -221,6 +221,9 @@ class twa_graph:
from spot.jupyter import SVG
return SVG(_ostream_to_svg(ostr))
def __copy__(self):
return make_twa_graph(self, twa_prop_set.all())
def make_twa_graph(*args):
from spot.impl import make_twa_graph as mtg