| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
EnvConfig.TestXMLOps.Test Class Reference
Inheritance diagram for EnvConfig.TestXMLOps.Test:
[legend]
Collaboration diagram for EnvConfig.TestXMLOps.Test:
[legend]

## Public Member Functions
def | setUp
def | tearDown
def | testFileLoad
def | testParsing

## Public Attributes
| control

## Detailed Description

Definition at line 13 of file TestXMLOps.py.

## Member Function Documentation

def EnvConfig.TestXMLOps.Test.setUp | ( |  | self | ) |

Definition at line 16 of file TestXMLOps.py.

16
17 def setUp(self):
18 pass

def EnvConfig.TestXMLOps.Test.tearDown | ( |  | self | ) |

Definition at line 19 of file TestXMLOps.py.

19
20 def tearDown(self):
21 pass

def EnvConfig.TestXMLOps.Test.testFileLoad | ( |  | self | ) |

    Test loading of previously written file.

Definition at line 22 of file TestXMLOps.py.

22
23 def testFileLoad(self):
24 '''Test loading of previously written file.'''
25 self.control = Control.Environment(useAsWriter = True)
26 self.control.unset('varToUnset')
27
28 self.control.declare('myVar', 'list', True)
29 self.control.set('myVar', 'setVal:$local')
30 self.control.append('myVar', 'appVal:appVal2')
31 self.control.prepend('myVar', 'prepVal:prepVal2')
32
33 self.control.declare('myScalar', 'scalar', False)
34 self.control.set('myScalar', 'setValscal')
35 self.control.append('myScalar', 'appValscal')
36 self.control.prepend('myScalar', 'prepValscal')
37
38 self.control.declare('myScalar2', 'scalar', True)
39
40 self.control.finishXMLinput('testOutputFile.xml')
41
42 loader = xmlModule.XMLFile()
43 variables = loader.variable('testOutputFile.xml')
44
45 expected = [('declare', ('varToUnset', 'list', 'false')),
46 ('unset', ('varToUnset', '', None)),
47 ('declare', ('myVar', 'list', 'true')),
48 ('set', ('myVar', 'setVal:$local', None)),
49 ('append', ('myVar', 'appVal:appVal2', None)),
50 ('prepend', ('myVar', 'prepVal:prepVal2', None)),
51 ('declare', ('myScalar', 'scalar', 'false')),
52 ('set', ('myScalar', 'setValscal', None)),
53 ('append', ('myScalar', 'appValscal', None)),
54 ('prepend', ('myScalar', 'prepValscal', None)),
55 ('declare', ('myScalar2', 'scalar', 'true'))]
56
57 self.assertEqual(variables, expected)
58
59 os.remove('testOutputFile.xml')

def EnvConfig.TestXMLOps.Test.testParsing | ( |  | self | ) |

Definition at line 60 of file TestXMLOps.py.

60
61 def testParsing(self):
62 data = StringIO('''<?xml version="1.0" ?>
63 <env:config xmlns:env="EnvSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="EnvSchema ./EnvSchema.xsd ">
64 <env:declare local="false" type="list" variable="varToUnset"/>
65 <env:unset variable="varToUnset"/>
66 <env:declare local="true" type="list" variable="myVar"/>
67 <env:set variable="myVar">setVal:$local</env:set>
68 <env:append variable="myVar">appVal:appVal2</env:append>
69 <env:prepend variable="myVar">prepVal:prepVal2</env:prepend>
70 <env:declare local="false" type="scalar" variable="myScalar"/>
71 <env:set variable="myScalar">setValscal</env:set>
72 <env:append variable="myScalar">appValscal</env:append>
73 <env:prepend variable="myScalar">prepValscal</env:prepend>
74 <env:declare local="true" type="scalar" variable="myScalar2"/>
75 <env:include>some_file.xml</env:include>
76 <env:include hints="some:place">another_file.xml</env:include>
77 </env:config>''')
78
79 loader = xmlModule.XMLFile()
80 variables = loader.variable(data)
81
82 expected = [('declare', ('varToUnset', 'list', 'false')),
83 ('unset', ('varToUnset', '', None)),
84 ('declare', ('myVar', 'list', 'true')),
85 ('set', ('myVar', 'setVal:$local', None)),
86 ('append', ('myVar', 'appVal:appVal2', None)),
87 ('prepend', ('myVar', 'prepVal:prepVal2', None)),
88 ('declare', ('myScalar', 'scalar', 'false')),
89 ('set', ('myScalar', 'setValscal', None)),
90 ('append', ('myScalar', 'appValscal', None)),
91 ('prepend', ('myScalar', 'prepValscal', None)),
92 ('declare', ('myScalar2', 'scalar', 'true')),
93 ('include', ('some_file.xml', None, '')),
94 ('include', ('another_file.xml', None, 'some:place'))]
95
96 self.assertEqual(variables, expected)

## Member Data Documentation

EnvConfig.TestXMLOps.Test.control

Definition at line 24 of file TestXMLOps.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/cmake/EnvConfig/TestXMLOps.py