Merge lp:~boegholm/pyuppaal/780495-fix into lp:pyuppaal

Proposed by Thomas Bøgholm
Status: Merged
Approved by: Kenneth Yrke Jørgensen
Approved revision: 95
Merged at revision: 95
Proposed branch: lp:~boegholm/pyuppaal/780495-fix
Merge into: lp:pyuppaal
Diff against target: 65 lines (+18/-2)
3 files modified
pyuppaal/pyuppaal.py (+6/-2)
tests/test_import.py (+5/-0)
tests/urgent.xml (+7/-0)
To merge this branch: bzr merge lp:~boegholm/pyuppaal/780495-fix
Reviewer Review Type Date Requested Status
Kenneth Yrke Jørgensen Approve
Review via email: mp+60503@code.launchpad.net

Commit message

Description of the change

bugfix for bug #780495

To post a comment you must log in.
Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

Looks good

review: Approve
Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

Very awesome,

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pyuppaal/pyuppaal.py'
2--- pyuppaal/pyuppaal.py 2011-04-07 15:48:41 +0000
3+++ pyuppaal/pyuppaal.py 2011-05-10 13:07:25 +0000
4@@ -209,10 +209,11 @@
5
6 class Location:
7 @require_keyword_args(1)
8- def __init__(self, invariant=None, committed=False, name=None, id = None,
9+ def __init__(self, invariant=None, urgent=False, committed=False, name=None, id = None,
10 xpos=0, ypos=0):
11 self.invariant = Label("invariant", invariant)
12 self.committed = committed
13+ self.urgent = urgent
14 self.name = Label("name", name)
15 self.id = id
16 self.xpos = xpos
17@@ -232,8 +233,9 @@
18 %s
19 %s
20 %s
21+ %s
22 </location>""" % (self.id, self.xpos, self.ypos, namexml, invariantxml,
23- self.committed and '<committed />' or '')
24+ self.committed and '<committed />' or '', self.urgent and '<urgent />' or '')
25
26 class Branchpoint:
27 @require_keyword_args(1)
28@@ -335,6 +337,8 @@
29 )
30 if locationxml.find("committed") != None:
31 location.committed = True
32+ if locationxml.find("urgent") != None:
33+ location.urgent = True
34 for labelxml in locationxml.getiterator("label"):
35 if labelxml.get('kind') == 'invariant':
36 location.invariant = Label("invariant", labelxml.text)
37
38=== modified file 'tests/test_import.py'
39--- tests/test_import.py 2011-03-29 17:41:22 +0000
40+++ tests/test_import.py 2011-05-10 13:07:25 +0000
41@@ -84,6 +84,11 @@
42 self.assertEqual(nta.templates[0].locations[0].xpos, 0)
43 self.assertEqual(nta.templates[0].locations[0].ypos, 0)
44
45+ def test_import_urgent(self):
46+ file = open(os.path.join(os.path.dirname(sys.argv[0]), 'urgent.xml'))
47+ nta = pyuppaal.from_xml(file)
48+ self.assertEqual(nta.templates[0].locations[0].urgent, True)
49+
50 def test_import_nocoords(self):
51 file = open(os.path.join(os.path.dirname(sys.argv[0]), 'small_nocoords.xml'))
52 nta = pyuppaal.from_xml(file)
53
54=== added file 'tests/urgent.xml'
55--- tests/urgent.xml 1970-01-01 00:00:00 +0000
56+++ tests/urgent.xml 2011-05-10 13:07:25 +0000
57@@ -0,0 +1,7 @@
58+<?xml version="1.0" encoding="utf-8"?><!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_1.dtd'><nta><declaration>// Place global declarations here.
59+</declaration><template><name x="5" y="5">Template</name><declaration>// Place local declarations here.
60+</declaration><location id="id0" x="16" y="-40"><urgent/></location><init ref="id0"/></template><system>// Place template instantiations here.
61+Process = Template();
62+
63+// List one or more processes to be composed into a system.
64+system Process;</system></nta>
65\ No newline at end of file

Subscribers

People subscribed via source and target branches