DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
test_configobject.ConfigObject Class Reference
Inheritance diagram for test_configobject.ConfigObject:
[legend]
Collaboration diagram for test_configobject.ConfigObject:
[legend]

Public Member Functions

 test00_CanReadWriteBool (self)
 
 test01_CanReadWriteInt8 (self)
 
 test02_CanReadWriteUInt8 (self)
 
 test03_CanReadWriteInt16 (self)
 
 test04_CanReadWriteUInt16 (self)
 
 test05_CanReadWriteInt32 (self)
 
 test06_CanReadWriteUInt32 (self)
 
 test07_CanReadWriteInt64 (self)
 
 test08_CanReadWriteUInt64 (self)
 
 test08a_CanReadWriteUInt64WithRange (self)
 
 test09_CanReadWriteString (self)
 
 test10_CanReadWriteEnum (self)
 
 test11_CanReadWriteStringList (self)
 
 test12_CanReadWriteDate (self)
 
 test13_CanReadWriteTime (self)
 
 test14_CanReadWriteClassReference (self)
 
 test15_CanReadWriteSingleValuedRelations (self)
 
 test16_CanReadWriteMultiValuedRelations (self)
 
 test17_CanRename (self)
 

Detailed Description

Definition at line 46 of file test_configobject.py.

Member Function Documentation

◆ test00_CanReadWriteBool()

test_configobject.ConfigObject.test00_CanReadWriteBool ( self)

Definition at line 48 of file test_configobject.py.

48 def test00_CanReadWriteBool(self):
49 limit_test(self, 'bool', False, True)
50

◆ test01_CanReadWriteInt8()

test_configobject.ConfigObject.test01_CanReadWriteInt8 ( self)

Definition at line 51 of file test_configobject.py.

51 def test01_CanReadWriteInt8(self):
52 limit_test(self, 'sint8', -2**7, (2**7)-1)
53 limit_test_raise(self, 'sint8', -2**7, (2**7)-1)
54

◆ test02_CanReadWriteUInt8()

test_configobject.ConfigObject.test02_CanReadWriteUInt8 ( self)

Definition at line 55 of file test_configobject.py.

55 def test02_CanReadWriteUInt8(self):
56 limit_test(self, 'uint8', 0, (2**8)-1)
57 limit_test_raise(self, 'uint8', 0, (2**8)-1)
58

◆ test03_CanReadWriteInt16()

test_configobject.ConfigObject.test03_CanReadWriteInt16 ( self)

Definition at line 59 of file test_configobject.py.

59 def test03_CanReadWriteInt16(self):
60 limit_test(self, 'sint16', -2**15, (2**15)-1)
61 limit_test_raise(self, 'sint16', -2**15, (2**15)-1)
62

◆ test04_CanReadWriteUInt16()

test_configobject.ConfigObject.test04_CanReadWriteUInt16 ( self)

Definition at line 63 of file test_configobject.py.

63 def test04_CanReadWriteUInt16(self):
64 limit_test(self, 'uint16', 0, (2**16)-1)
65 limit_test_raise(self, 'uint16', 0, (2**16)-1)
66

◆ test05_CanReadWriteInt32()

test_configobject.ConfigObject.test05_CanReadWriteInt32 ( self)

Definition at line 67 of file test_configobject.py.

67 def test05_CanReadWriteInt32(self):
68 limit_test(self, 'sint32', -2**31, (2**31)-1)
69 limit_test_raise(self, 'sint32', -2**31, (2**31)-1)
70

◆ test06_CanReadWriteUInt32()

test_configobject.ConfigObject.test06_CanReadWriteUInt32 ( self)

Definition at line 71 of file test_configobject.py.

71 def test06_CanReadWriteUInt32(self):
72 limit_test(self, 'uint32', 0, (2**32)-1)
73 # The next test actually will fail on 32-bit machines if we set the
74 # lower limit to 0. It works OK in other platforms. The bug is related
75 # to the function PyLong_AsUnsignedLongLong() and variants that convert
76 # '-1L' to the highest possible 32-bit unsigned integer not raising an
77 # negative OverflowError as in the other convertions above.
78 # limit_test_raise(self, 'uint32', 0, (2**32)-1)
79

◆ test07_CanReadWriteInt64()

test_configobject.ConfigObject.test07_CanReadWriteInt64 ( self)

Definition at line 80 of file test_configobject.py.

80 def test07_CanReadWriteInt64(self):
81 limit_test(self, 'sint64', -2**63, (2**63)-1)
82 limit_test_raise(self, 'sint64', -2**63, (2**63)-1)
83

◆ test08_CanReadWriteUInt64()

test_configobject.ConfigObject.test08_CanReadWriteUInt64 ( self)

Definition at line 84 of file test_configobject.py.

84 def test08_CanReadWriteUInt64(self):
85 limit_test(self, 'uint64', 0, (2**64)-1)
86 # The next test actually will fail on 64-bit machines if we set the
87 # lower limit to 0. It works OK in other platforms. The bug is related
88 # to the function PyLong_AsUnsignedLongLong() and variants that convert
89 # '-1L' to the highest possible 64-bit unsigned integer not raising an
90 # negative OverflowError as in the other convertions above.
91 # limit_test_raise(self, 'uint64', 0, (2**64)-1)
92

◆ test08a_CanReadWriteUInt64WithRange()

test_configobject.ConfigObject.test08a_CanReadWriteUInt64WithRange ( self)

Definition at line 93 of file test_configobject.py.

93 def test08a_CanReadWriteUInt64WithRange(self):
94 db = conffwk.Configuration("oksconflibs")
95 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
96 t = db.create_obj("Dummy", "TestDummy-1")
97 attrname = 'uint64_vector_range'
98 min = 2**64 - 16
99 max = 2**64 - 1
100 val = [min, max]
101 t[attrname] = val
102 self.assertEqual(t[attrname], val)
103 self.assertRaises(ValueError, t.__setitem__, attrname, [0, 1, 2])
104 db.commit()
105

◆ test09_CanReadWriteString()

test_configobject.ConfigObject.test09_CanReadWriteString ( self)

Definition at line 106 of file test_configobject.py.

106 def test09_CanReadWriteString(self):
107 db = conffwk.Configuration("oksconflibs")
108 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
109 t = db.create_obj("Dummy", "TestDummy-1")
110 val = 'bla'
111 attrname = 'string'
112 t[attrname] = val
113 self.assertEqual(t[attrname], val)
114 db.commit()
115

◆ test10_CanReadWriteEnum()

test_configobject.ConfigObject.test10_CanReadWriteEnum ( self)

Definition at line 116 of file test_configobject.py.

116 def test10_CanReadWriteEnum(self):
117 db = conffwk.Configuration("oksconflibs")
118 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
119 t = db.create_obj("Dummy", "TestDummy-1")
120 val = 'FIRST'
121 attrname = 'enum'
122 t[attrname] = val
123 self.assertEqual(t[attrname], val)
124 val = 'DOES NOT EXIST'
125 self.assertRaises(ValueError, t.__setitem__, attrname, val)
126

◆ test11_CanReadWriteStringList()

test_configobject.ConfigObject.test11_CanReadWriteStringList ( self)

Definition at line 127 of file test_configobject.py.

127 def test11_CanReadWriteStringList(self):
128 db = conffwk.Configuration("oksconflibs")
129 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
130 t = db.create_obj("Dummy", "TestDummy-1")
131 val = ["test10", "test20"]
132 attrname = 'string_vector'
133 t[attrname] = val
134 self.assertEqual(t[attrname], val)
135

◆ test12_CanReadWriteDate()

test_configobject.ConfigObject.test12_CanReadWriteDate ( self)

Definition at line 136 of file test_configobject.py.

136 def test12_CanReadWriteDate(self):
137 db = conffwk.Configuration("oksconflibs")
138 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
139 t = db.create_obj("Dummy", "TestDummy-1")
140 val = "2000-Jan-01"
141 attrname = 'date'
142 t[attrname] = val
143 self.assertEqual(t[attrname], val)
144

◆ test13_CanReadWriteTime()

test_configobject.ConfigObject.test13_CanReadWriteTime ( self)

Definition at line 145 of file test_configobject.py.

145 def test13_CanReadWriteTime(self):
146 db = conffwk.Configuration("oksconflibs")
147 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
148 t = db.create_obj("Dummy", "TestDummy-1")
149 val = "2000-Jan-01 00:00:00"
150 attrname = 'time'
151 t[attrname] = val
152 self.assertEqual(t[attrname], val)
153

◆ test14_CanReadWriteClassReference()

test_configobject.ConfigObject.test14_CanReadWriteClassReference ( self)

Definition at line 154 of file test_configobject.py.

154 def test14_CanReadWriteClassReference(self):
155 db = conffwk.Configuration("oksconflibs")
156 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
157 t = db.create_obj("Dummy", "TestDummy-1")
158 val = 'Second'
159 attrname = 'classref'
160 t[attrname] = val
161 self.assertEqual(t[attrname], val)
162 self.assertRaises(ValueError, t.__setitem__, attrname, 'DoesNotExist')
163 db.commit()
164

◆ test15_CanReadWriteSingleValuedRelations()

test_configobject.ConfigObject.test15_CanReadWriteSingleValuedRelations ( self)

Definition at line 165 of file test_configobject.py.

165 def test15_CanReadWriteSingleValuedRelations(self):
166 db = conffwk.Configuration("oksconflibs")
167 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
168 relation = db.create_obj("Dummy", "Single-Relation")
169 t = db.create_obj('Third', 'Originator')
170 attrname = 'Another'
171 self.assertEqual(t[attrname], None) # problem
172 t[attrname] = relation
173 self.assertEqual(t[attrname], relation)
174 db.commit()
175

◆ test16_CanReadWriteMultiValuedRelations()

test_configobject.ConfigObject.test16_CanReadWriteMultiValuedRelations ( self)

Definition at line 176 of file test_configobject.py.

176 def test16_CanReadWriteMultiValuedRelations(self):
177 db = conffwk.Configuration("oksconflibs")
178 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
179 relations = []
180 for i in range(10):
181 relations.append(db.create_obj("Second", "Relation-%d" % i))
182 t = db.create_obj('Third', 'Originator')
183 attrname = 'Seconds'
184 t[attrname] = relations
185 self.assertEqual(t[attrname], relations)
186 db.commit()
187

◆ test17_CanRename()

test_configobject.ConfigObject.test17_CanRename ( self)

Definition at line 188 of file test_configobject.py.

188 def test17_CanRename(self):
189 db = conffwk.Configuration("oksconflibs")
190 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
191 t = db.create_obj('Dummy', 'TestDummy-1')
192 t.rename('TestDummy-2')
193 self.assertEqual(t.UID(), 'TestDummy-2')
194 t2 = db.get_obj('Dummy', 'TestDummy-2')
195 self.assertEqual(t, t2)
196 db.commit()
197
198

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