/[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 4938 - (show annotations)
Wed May 14 01:13:23 2014 UTC (5 years, 3 months ago) by jfenwick
File MIME type: text/x-python
File size: 2499 byte(s)
Modify unit tests to read their classes from
esys.escriptcore.utestselect

Change the line in that file to switch between unittest and unittest2


1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 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 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 """
25 Test to ensure that modification of shared Data does not occur
26 """
27
28 import esys.escriptcore.utestselect as unittest
29 from esys.escript import *
30
31 class Test_Shared(unittest.TestCase):
32 def test_setToZero(self):
33 d=Data(42)
34 e=d.delay()
35 d.setToZero()
36 self.assertTrue(Lsup(e-42)<=self.tol)
37
38 def test_copyConstr(self):
39 d=Data(42)
40 e=Data(d)
41 d+=17
42 self.assertTrue(Lsup(e-42)<=self.tol)
43
44 # This should not fail (even in the old code) but it doesn't hurt to check
45 def test_Copy(self):
46 d=Data(42)
47 e=d.copy()
48 d+=17
49 self.assertTrue(Lsup(e-42)<=self.tol)
50
51 def test_eqops(self):
52 d=Data(42)
53 e=d.delay()
54 d+=17
55 self.assertTrue(Lsup(e-42)<=self.tol)
56 d=Data(42)
57 e=d.delay()
58 d-=1
59 self.assertTrue(Lsup(e-42)<=self.tol)
60 d*=3
61 d=Data(42)
62 e=d.delay()
63 d/=2
64 self.assertTrue(Lsup(e-42)<=self.tol)
65
66 def test_setItem(self):
67 d=Data(42)
68 e=d.delay()
69 d[tuple()]=17
70 self.assertTrue(Lsup(e-42)<=self.tol)
71
72
73 def test_setTaggedValue(self):
74 d=Data(42,self.domain.getX().getFunctionSpace()) # doesn't really matter which non-NULL FS we use
75 d.tag()
76 self.domain.setTagMap("TestTag",2)
77 e=d.delay()
78 d.setTaggedValue("TestTag",17)
79 e.resolve()
80 self.assertTrue(str(e)!=str(d))
81 e=d.delay()
82 d.setTaggedValue(1,12)
83 e.resolve()
84 self.assertTrue(str(e)!=str(d))
85
86
87
88

  ViewVC Help
Powered by ViewVC 1.1.26