/[escript]/trunk/escriptcore/test/python/test_shared.py
ViewVC logotype

Contents of /trunk/escriptcore/test/python/test_shared.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4154 - (show annotations)
Tue Jan 22 09:30:23 2013 UTC (6 years, 8 months ago) by jfenwick
Original Path: trunk/escript/test/python/test_shared.py
File MIME type: text/x-python
File size: 2399 byte(s)
Round 1 of copyright fixes
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2013 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 __copyright__="""Copyright (c) 2003-2013 by University of Queensland
17 http://www.uq.edu.au
18 Primary Business: Queensland, Australia"""
19 __license__="""Licensed under the Open Software License version 3.0
20 http://www.opensource.org/licenses/osl-3.0.php"""
21 __url__="https://launchpad.net/escript-finley"
22
23 """
24 Test to ensure that modification of shared Data does not occur
25 """
26
27 import unittest
28 from esys.escript import *
29
30 class Test_Shared(unittest.TestCase):
31 def test_setToZero(self):
32 d=Data(42)
33 e=d.delay()
34 d.setToZero()
35 self.assertTrue(Lsup(e-42)<=self.tol)
36
37 def test_copyConstr(self):
38 d=Data(42)
39 e=Data(d)
40 d+=17
41 self.assertTrue(Lsup(e-42)<=self.tol)
42
43 # This should not fail (even in the old code) but it doesn't hurt to check
44 def test_Copy(self):
45 d=Data(42)
46 e=d.copy()
47 d+=17
48 self.assertTrue(Lsup(e-42)<=self.tol)
49
50 def test_eqops(self):
51 d=Data(42)
52 e=d.delay()
53 d+=17
54 self.assertTrue(Lsup(e-42)<=self.tol)
55 d=Data(42)
56 e=d.delay()
57 d-=1
58 self.assertTrue(Lsup(e-42)<=self.tol)
59 d*=3
60 d=Data(42)
61 e=d.delay()
62 d/=2
63 self.assertTrue(Lsup(e-42)<=self.tol)
64
65 def test_setItem(self):
66 d=Data(42)
67 e=d.delay()
68 d[tuple()]=17
69 self.assertTrue(Lsup(e-42)<=self.tol)
70
71
72 def test_setTaggedValue(self):
73 d=Data(42,self.domain.getX().getFunctionSpace()) # doesn't really matter which non-NULL FS we use
74 d.tag()
75 self.domain.setTagMap("TestTag",2)
76 e=d.delay()
77 d.setTaggedValue("TestTag",17)
78 e.resolve()
79 self.assertTrue(str(e)!=str(d))
80 e=d.delay()
81 d.setTaggedValue(1,12)
82 e.resolve()
83 self.assertTrue(str(e)!=str(d))
84
85
86
87

  ViewVC Help
Powered by ViewVC 1.1.26