DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
test_dal.DalTest Class Reference
Inheritance diagram for test_dal.DalTest:
[legend]
Collaboration diagram for test_dal.DalTest:
[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)
 test09_CanReadWriteStringsWithRanges (self)
 test10_CanReadWrite64bitVectors (self)
 test11_CanReadWrite64bitVectorsAndWithRange (self)
 test12_CanReadWriteEnum (self)
 test13_CanReadWriteDate (self)
 test14_CanReadWriteTime (self)
 test15_CanReadWriteClassReference (self)
 test16_CanNotSetUnexistingAttribute (self)
 test17_AttributeInheritance (self)
 test18_CanCompareDals (self)
 test19_CanReadWriteSingleValuedRelations (self)
 test20_CanReadWriteMultiValuedRelations (self)
 test21_CanAttributeFromConstructor (self)
 test22_CanReadWriteDalOnConfiguration (self)
 test23_CanSearchForDalsAtConfiguration (self)
 test24_CanReadWriteBigDatabases (self)
 test25_CanRecurseALot (self)
 test26_CanModifyDatabases (self)
 test27_CanSearchUsingBaseClasses (self)
 test28_CanHandleInheritanceAtSearch (self)
 test29_CanWriteInfiniteRecursion (self)
 test30_CanReadInfiniteRecursion (self)
 test31_CanWriteBiggerRecursion (self)
 test32_CanReadBiggerRecursion (self)
 test33_CanHandleDalDestruction (self)
 test34_CanModifyNonRecursively (self)
 test35_CannotMoveIfNotIncluded (self)
 test36_CanSearchForObjects (self)
 test37_BookkeepUpdatedObjects (self)
 test38_CanRename (self)

Detailed Description

Definition at line 39 of file test_dal.py.

Member Function Documentation

◆ test00_CanReadWriteBool()

test_dal.DalTest.test00_CanReadWriteBool ( self)

Definition at line 41 of file test_dal.py.

41 def test00_CanReadWriteBool(self):
42 obj = test.Dummy('Test-1')
43 test_good(self, obj, 'bool', [True, False, 0, 1])
44

◆ test01_CanReadWriteInt8()

test_dal.DalTest.test01_CanReadWriteInt8 ( self)

Definition at line 45 of file test_dal.py.

45 def test01_CanReadWriteInt8(self):
46 obj = test.Dummy('Test-1')
47 test_good(self, obj, 'sint8', [-2**7, 2**7-1, 0, 0xa])
48 test_bad(self, obj, 'sint8', [-2**7-1, 2**7, 0xab])
49

◆ test02_CanReadWriteUInt8()

test_dal.DalTest.test02_CanReadWriteUInt8 ( self)

Definition at line 50 of file test_dal.py.

50 def test02_CanReadWriteUInt8(self):
51 obj = test.Dummy('Test-1')
52 test_good(self, obj, 'uint8', [0, 2**8-1, 42, 0xab])
53 test_bad(self, obj, 'uint8', [-1, 2**8, 0xabc])
54

◆ test03_CanReadWriteInt16()

test_dal.DalTest.test03_CanReadWriteInt16 ( self)

Definition at line 55 of file test_dal.py.

55 def test03_CanReadWriteInt16(self):
56 obj = test.Dummy('Test-1')
57 test_good(self, obj, 'sint16', [-2**15, 2**15-1, 42, 0xa])
58 test_bad(self, obj, 'sint8', [-2**15-1, 2**15, 0xabcd])
59

◆ test04_CanReadWriteUInt16()

test_dal.DalTest.test04_CanReadWriteUInt16 ( self)

Definition at line 60 of file test_dal.py.

60 def test04_CanReadWriteUInt16(self):
61 obj = test.Dummy('Test-1')
62 test_good(self, obj, 'uint16', [0, 2**16-1, 42, 0xabcd])
63 test_bad(self, obj, 'uint16', [-1, 2**16, 0xabcde])
64

◆ test05_CanReadWriteInt32()

test_dal.DalTest.test05_CanReadWriteInt32 ( self)

Definition at line 65 of file test_dal.py.

65 def test05_CanReadWriteInt32(self):
66 obj = test.Dummy('Test-1')
67 test_good(self, obj, 'sint32', [-2**31, 2**31-1, 42, 0xa])
68 test_bad(self, obj, 'sint32', [-2**31-1, 2**31, 0xabcdabcdabcd])
69

◆ test06_CanReadWriteUInt32()

test_dal.DalTest.test06_CanReadWriteUInt32 ( self)

Definition at line 70 of file test_dal.py.

70 def test06_CanReadWriteUInt32(self):
71 obj = test.Dummy('Test-1')
72 test_good(self, obj, 'uint32', [0, 2**32-1, 42, 0xabcd])
73 test_bad(self, obj, 'uint32', [-1, 2**32, 0xabcdeabcdeabcde])
74

◆ test07_CanReadWriteInt64()

test_dal.DalTest.test07_CanReadWriteInt64 ( self)

Definition at line 75 of file test_dal.py.

75 def test07_CanReadWriteInt64(self):
76 obj = test.Dummy('Test-1')
77 test_good(self, obj, 'sint64', [-2**63, 2**63-1, 42, 0xa])
78 test_bad(self, obj, 'sint64', [-2**63-1,
79 2**63, 0xabcdabcdabcdabcabcabc])
80

◆ test08_CanReadWriteUInt64()

test_dal.DalTest.test08_CanReadWriteUInt64 ( self)

Definition at line 81 of file test_dal.py.

81 def test08_CanReadWriteUInt64(self):
82 obj = test.Dummy('Test-1')
83 test_good(self, obj, 'uint64', [0, 2**64-1, 42, 0xabcd])
84 test_bad(self, obj, 'uint64',
85 [-1, 2**64, 0xabcdeabcdeabcdeabcabcffabc])
86

◆ test09_CanReadWriteStringsWithRanges()

test_dal.DalTest.test09_CanReadWriteStringsWithRanges ( self)

Definition at line 87 of file test_dal.py.

87 def test09_CanReadWriteStringsWithRanges(self):
88 obj = test.Dummy('Test-1')
89 test_good(self, obj, 'string_vector', [
90 ['test01', 'test09'], ['test30']])
91 test_bad(self, obj, 'string_vector', [['Test01', 'test111'], ['abcd']])
92

◆ test10_CanReadWrite64bitVectors()

test_dal.DalTest.test10_CanReadWrite64bitVectors ( self)

Definition at line 93 of file test_dal.py.

93 def test10_CanReadWrite64bitVectors(self):
94 obj = test.Dummy('Test-1')
95 test_good(self, obj, 'uint64_vector', [[0, 1], [0]])
96 test_bad(self, obj, 'uint64_vector', [[0, -1], [2**65]])
97

◆ test11_CanReadWrite64bitVectorsAndWithRange()

test_dal.DalTest.test11_CanReadWrite64bitVectorsAndWithRange ( self)

Definition at line 98 of file test_dal.py.

98 def test11_CanReadWrite64bitVectorsAndWithRange(self):
99 obj = test.Dummy('Test-1')
100 test_good(self, obj, 'uint64_vector_range', [[18446744073709551600,
101 18446744073709551615],
102 [18446744073709551610]])
103 test_bad(self, obj, 'uint64_vector_range', [[0, -1], 10])
104

◆ test12_CanReadWriteEnum()

test_dal.DalTest.test12_CanReadWriteEnum ( self)

Definition at line 105 of file test_dal.py.

105 def test12_CanReadWriteEnum(self):
106 obj = test.Dummy('Test-1')
107 test_good(self, obj, 'enum', ['FIRST', 'SECOND'])
108 test_bad(self, obj, 'string_vector', ['first', 'zeroth'])
109

◆ test13_CanReadWriteDate()

test_dal.DalTest.test13_CanReadWriteDate ( self)

Definition at line 110 of file test_dal.py.

110 def test13_CanReadWriteDate(self):
111 obj = test.Dummy('Test-1')
112 test_good(self, obj, 'date', ['31/12/73', '01/01/70'])
113 test_bad(self, obj, 'date', ['31/00/19', '-1'])
114

◆ test14_CanReadWriteTime()

test_dal.DalTest.test14_CanReadWriteTime ( self)

Definition at line 115 of file test_dal.py.

115 def test14_CanReadWriteTime(self):
116 obj = test.Dummy('Test-1')
117 test_good(self, obj, 'time', [
118 '31/12/73 02:03:04', '01/01/70 00:00:59'])
119 test_bad(self, obj, 'time', ['31/12/73 24:23:22', '-1'])
120

◆ test15_CanReadWriteClassReference()

test_dal.DalTest.test15_CanReadWriteClassReference ( self)

Definition at line 121 of file test_dal.py.

121 def test15_CanReadWriteClassReference(self):
122 obj = test.Dummy('Test-1')
123 test_good(self, obj, 'classref', ['Dummy', 'Third'])
124 test_bad(self, obj, 'classref', ['DoesNotExistInDal'])
125

◆ test16_CanNotSetUnexistingAttribute()

test_dal.DalTest.test16_CanNotSetUnexistingAttribute ( self)

Definition at line 126 of file test_dal.py.

126 def test16_CanNotSetUnexistingAttribute(self):
127 obj = test.Dummy('Test-1')
128 self.assertRaises(AttributeError, setattr, obj, 'doesNotExist', 24)
129

◆ test17_AttributeInheritance()

test_dal.DalTest.test17_AttributeInheritance ( self)

Definition at line 130 of file test_dal.py.

130 def test17_AttributeInheritance(self):
131 obj = test.Third('Test-1')
132 test_good(self, obj, 'classref', ['Second', 'Third', 'Dummy'])
133 test_bad(self, obj, 'classref', ['DoesNotExistInDal'])
134

◆ test18_CanCompareDals()

test_dal.DalTest.test18_CanCompareDals ( self)

Definition at line 135 of file test_dal.py.

135 def test18_CanCompareDals(self):
136 obj1 = test.Dummy('Test-1')
137 obj2 = test.Dummy('Test-1')
138 self.assertEqual(obj1, obj2)
139 obj3 = test.Second('Test-1')
140 self.assertNotEqual(obj1, obj3)
141 obj4 = test.Dummy('Test-2')
142 self.assertNotEqual(obj1, obj4)
143

◆ test19_CanReadWriteSingleValuedRelations()

test_dal.DalTest.test19_CanReadWriteSingleValuedRelations ( self)

Definition at line 144 of file test_dal.py.

144 def test19_CanReadWriteSingleValuedRelations(self):
145 obj1 = test.Second('Test-1')
146 obj2 = test.Third('Test-2')
147 obj3 = test.Dummy('Test-3')
148 test_good(self, obj2, 'Single', [None, obj1])
149 test_bad(self, obj2, 'Single', [obj3, 4])
150

◆ test20_CanReadWriteMultiValuedRelations()

test_dal.DalTest.test20_CanReadWriteMultiValuedRelations ( self)

Definition at line 151 of file test_dal.py.

151 def test20_CanReadWriteMultiValuedRelations(self):
152 obj1 = test.Second('Test-1')
153 obj2 = test.Third('Test-2')
154 obj3 = test.Dummy('Test-3')
155 test_good(self, obj1, 'Dummy', [[], [obj3, obj2], [obj2]])
156 test_bad(self, obj2, 'Seconds', [[obj1, obj3]])
157

◆ test21_CanAttributeFromConstructor()

test_dal.DalTest.test21_CanAttributeFromConstructor ( self)

Definition at line 158 of file test_dal.py.

158 def test21_CanAttributeFromConstructor(self):
159 obj = test.Dummy('Test-1', string_vector=['test10', 'test20'])
160 self.assertEqual(obj.string_vector, ['test10', 'test20'])
161 obj2 = test.Second('Test-2', string_vector=['test20', 'test30'],
162 Dummy=[obj])
163 self.assertEqual(obj2.Dummy, [obj])
164

◆ test22_CanReadWriteDalOnConfiguration()

test_dal.DalTest.test22_CanReadWriteDalOnConfiguration ( self)

Definition at line 165 of file test_dal.py.

165 def test22_CanReadWriteDalOnConfiguration(self):
166 db = conffwk.Configuration("oksconflibs")
167 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
168 obj3 = test.Dummy('Test-3', string_vector=['test05', 'test06'])
169 obj1 = test.Second('Test-1', Dummy=[obj3], string_vector=['test30'])
170 obj2 = test.Third('Test-2', string_vector=['test10'], Seconds=[obj1])
171 db.update_dal(obj2, recurse=True) # should serialize everybody
172 db.commit()
173 ret = db.get_dal('Third', 'Test-2')
174 self.assertEqual(ret, obj2)
175 self.assertEqual(ret.Seconds[0], obj1)
176 self.assertEqual(ret.Seconds[0].Dummy[0], obj3)
177

◆ test23_CanSearchForDalsAtConfiguration()

test_dal.DalTest.test23_CanSearchForDalsAtConfiguration ( self)

Definition at line 178 of file test_dal.py.

178 def test23_CanSearchForDalsAtConfiguration(self):
179 db = conffwk.Configuration("oksconflibs")
180 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
181 obj3 = test.Dummy('Test-3', string_vector=['test05', 'test06'])
182 obj1 = test.Second('Test-1', Dummy=[obj3], string_vector=['test30'])
183 obj2 = test.Third('Test-2', string_vector=['test10'], Seconds=[obj1])
184 db.update_dal(obj2, recurse=True) # should serialize everybody
185 db.commit()
186 del db
187 db = conffwk.Configuration('oksconflibs:test.data.xml')
188 ret = db.get_dal('Third', 'Test-2')
189 self.assertEqual(ret, obj2)
190 self.assertEqual(ret.Seconds[0], obj1)
191 self.assertEqual(ret.Seconds[0].Dummy[0], obj3)
192 self.assertEqual(len(db.get_dals('Dummy')), 3)
193

◆ test24_CanReadWriteBigDatabases()

test_dal.DalTest.test24_CanReadWriteBigDatabases ( self)

Definition at line 194 of file test_dal.py.

194 def test24_CanReadWriteBigDatabases(self):
195 import sys
196 number = SIZE_TEST
197 previous = None
198 objs = []
199 for i in range(number):
200 objs.append(test.Second("Object-%d" % i))
201 db = conffwk.Configuration("oksconflibs")
202 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
203 for k in objs:
204 db.update_dal(k, recurse=True)
205 db.commit()
206 del db
207 db = conffwk.Configuration('oksconflibs:test.data.xml')
208 objs = db.get_dals('Second')
209 self.assertEqual(len(objs), number)
210

◆ test25_CanRecurseALot()

test_dal.DalTest.test25_CanRecurseALot ( self)

Definition at line 211 of file test_dal.py.

211 def test25_CanRecurseALot(self):
212 import sys
213 sys.setrecursionlimit(50000)
214 depth = RECURSION_TEST # 10000 seems to be impossible!
215 previous = None
216 for i in range(depth):
217 obj = test.Second("Object-%d" % i)
218 if previous:
219 obj.Another = previous
220 previous = obj
221 db = conffwk.Configuration("oksconflibs")
222 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
223 db.update_dal(previous, recurse=True)
224 db.commit()
225 del db
226 db = conffwk.Configuration('oksconflibs:test.data.xml')
227 top = db.get_dal('Second', 'Object-%d' % (depth-1))
228 counter = 0
229 while top:
230 counter += 1
231 top = top.Another
232 self.assertEqual(counter, depth)
233

◆ test26_CanModifyDatabases()

test_dal.DalTest.test26_CanModifyDatabases ( self)

Definition at line 234 of file test_dal.py.

234 def test26_CanModifyDatabases(self):
235 import sys
236 sys.setrecursionlimit(50000)
237 depth = RECURSION_TEST
238 db = conffwk.Configuration('oksconflibs:test.data.xml')
239 top = db.get_dal('Second', 'Object-%d' % (depth-1))
240 all = [top]
241 while top.Another:
242 all.append(top.Another)
243 top = top.Another
244 self.assertEqual(len(all), depth)
245
246 # reverse the linking order and update the database
247 all = list(reversed(all))
248 for i, k in enumerate(all):
249 if i < (len(all)-1):
250 k.Another = all[i+1]
251 else:
252 k.Another = None
253
254 # update the opened database
255 db.update_dal(all[0], recurse=True)
256 db.commit()
257 del db
258
259 # reopen and check
260 db = conffwk.Configuration('oksconflibs:test.data.xml')
261 top = db.get_dal('Second', 'Object-0') # that should be on the top now
262 counter = 0
263 while top:
264 counter += 1
265 top = top.Another
266 self.assertEqual(counter, depth)
267

◆ test27_CanSearchUsingBaseClasses()

test_dal.DalTest.test27_CanSearchUsingBaseClasses ( self)

Definition at line 268 of file test_dal.py.

268 def test27_CanSearchUsingBaseClasses(self):
269 # reopen and check
270 db = conffwk.Configuration('oksconflibs:test.data.xml')
271 self.assertEqual(len(db.get_dals('Dummy')), RECURSION_TEST)
272

◆ test28_CanHandleInheritanceAtSearch()

test_dal.DalTest.test28_CanHandleInheritanceAtSearch ( self)

Definition at line 273 of file test_dal.py.

273 def test28_CanHandleInheritanceAtSearch(self):
274 # reopen and check
275 db = conffwk.Configuration('oksconflibs:test.data.xml')
276 objs = db.get_dals('Dummy')
277 self.assertEqual(len(objs), RECURSION_TEST)
278 for k in objs:
279 self.assertEqual(k.className(), 'Second')
280

◆ test29_CanWriteInfiniteRecursion()

test_dal.DalTest.test29_CanWriteInfiniteRecursion ( self)

Definition at line 281 of file test_dal.py.

281 def test29_CanWriteInfiniteRecursion(self):
282 obj1 = test.Second('Obj-1')
283 obj2 = test.Second('Obj-2')
284 obj1.Another = obj2
285 obj2.Another = obj1
286 db = conffwk.Configuration("oksconflibs")
287 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
288 db.update_dal(obj1, recurse=True)
289 db.commit()
290

◆ test30_CanReadInfiniteRecursion()

test_dal.DalTest.test30_CanReadInfiniteRecursion ( self)

Definition at line 291 of file test_dal.py.

291 def test30_CanReadInfiniteRecursion(self):
292 db = conffwk.Configuration('oksconflibs:test.data.xml')
293 obj1 = db.get_dal('Second', 'Obj-1')
294 obj2 = db.get_dal('Second', 'Obj-2')
295 self.assertEqual(obj1.Another, obj2)
296 self.assertEqual(obj2.Another, obj1)
297

◆ test31_CanWriteBiggerRecursion()

test_dal.DalTest.test31_CanWriteBiggerRecursion ( self)

Definition at line 298 of file test_dal.py.

298 def test31_CanWriteBiggerRecursion(self):
299 obj1 = test.Second('Obj-1')
300 obj2 = test.Second('Obj-2')
301 obj3 = test.Second('Obj-3')
302 obj4 = test.Second('Obj-4')
303 obj1.Another = obj2
304 obj2.Another = obj3
305 obj3.Another = obj4
306 obj4.Another = obj1
307 db = conffwk.Configuration("oksconflibs")
308 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
309 db.update_dal(obj1, recurse=True)
310 db.commit()
311

◆ test32_CanReadBiggerRecursion()

test_dal.DalTest.test32_CanReadBiggerRecursion ( self)

Definition at line 312 of file test_dal.py.

312 def test32_CanReadBiggerRecursion(self):
313 db = conffwk.Configuration('oksconflibs:test.data.xml')
314 obj1 = db.get_dal('Second', 'Obj-1')
315 obj2 = db.get_dal('Second', 'Obj-2')
316 obj3 = db.get_dal('Second', 'Obj-3')
317 obj4 = db.get_dal('Second', 'Obj-4')
318 self.assertEqual(obj1.Another, obj2)
319 self.assertEqual(obj2.Another, obj3)
320 self.assertEqual(obj3.Another, obj4)
321 self.assertEqual(obj4.Another, obj1)
322

◆ test33_CanHandleDalDestruction()

test_dal.DalTest.test33_CanHandleDalDestruction ( self)

Definition at line 323 of file test_dal.py.

323 def test33_CanHandleDalDestruction(self):
324 db = conffwk.Configuration('oksconflibs:test.data.xml')
325 obj1 = db.get_dal('Second', 'Obj-1')
326 obj2 = db.get_dal('Second', 'Obj-2')
327 obj3 = db.get_dal('Second', 'Obj-3')
328 obj4 = db.get_dal('Second', 'Obj-4')
329 obj2.Another = None
330 # have to first eliminate ALL references
331 db.update_dal(obj2, recurse=True)
332 db.destroy_dal(obj3)
333 db.commit()
334 del db
335 db = conffwk.Configuration('oksconflibs:test.data.xml')
336 obj1 = db.get_dal('Second', 'Obj-1')
337 obj2 = db.get_dal('Second', 'Obj-2')
338 self.assertRaises(RuntimeError, db.get_dal, 'Second', 'Obj-3')
339 obj4 = db.get_dal('Second', 'Obj-4')
340

◆ test34_CanModifyNonRecursively()

test_dal.DalTest.test34_CanModifyNonRecursively ( self)

Definition at line 341 of file test_dal.py.

341 def test34_CanModifyNonRecursively(self):
342 db = conffwk.Configuration('oksconflibs:test.data.xml')
343 obj1 = db.get_dal('Second', 'Obj-1')
344 obj1.Another = None
345 obj2 = db.get_dal('Second', 'Obj-2')
346 obj2.string = 'xyzabc'
347 db.update_dal(obj1, recurse=False)
348 db.commit()
349 del db
350 db = conffwk.Configuration('oksconflibs:test.data.xml')
351 obj1 = db.get_dal('Second', 'Obj-1')
352 self.assertNotEqual(obj1.Another, obj2)
353 self.assertEqual(obj1.Another, None)
354 obj2 = db.get_dal('Second', 'Obj-2')
355 self.assertNotEqual(obj2.string, 'xyzabc')
356

◆ test35_CannotMoveIfNotIncluded()

test_dal.DalTest.test35_CannotMoveIfNotIncluded ( self)

Definition at line 357 of file test_dal.py.

357 def test35_CannotMoveIfNotIncluded(self):
358 obj11 = test.Second('Obj-11')
359 obj22 = test.Second('Obj-22')
360 obj33 = test.Second('Obj-33')
361 obj44 = test.Second('Obj-44')
362 obj11.Another = obj22
363 obj22.Another = obj33
364 obj33.Another = obj44
365 obj44.Another = obj11
366 db = conffwk.Configuration("oksconflibs")
367 db.create_db("test2.data.xml", [f'{scriptsdir}/test.schema.xml'])
368 db.update_dal(obj11, recurse=True)
369 db.commit()
370 del db
371
372 db = conffwk.Configuration('oksconflibs:test.data.xml')
373 obj1 = db.get_dal('Second', 'Obj-1')
374 obj1.Another = obj22
375 self.assertRaises(RuntimeError, db.update_dal, obj1, recurse=False)
376 db.add_include('test2.data.xml')
377 db.update_dal(obj1, recurse=False)
378 self.assertEqual(True, obj22 in db.get_all_dals())
379 db.commit()
380 del db
381

◆ test36_CanSearchForObjects()

test_dal.DalTest.test36_CanSearchForObjects ( self)

Definition at line 382 of file test_dal.py.

382 def test36_CanSearchForObjects(self):
383 db = conffwk.Configuration("oksconflibs")
384 db.create_db("test.data.xml", [f'{scriptsdir}/test.schema.xml'])
385 obj3 = test.Dummy('Test-3', string_vector=['test05', 'test06'])
386 obj1 = test.Second('Test-1', Dummy=[obj3], string_vector=['test30'])
387 obj2 = test.Third('Test-2', string_vector=['test10'], Seconds=[obj1])
388 db.update_dal(obj2, recurse=True) # should serialize everybody
389 db.commit()
390 del db
391 db = conffwk.Configuration('oksconflibs:test.data.xml')
392 ret = db.get_dal('Third', 'Test-2')
393
394 import re
395 self.assertEqual(ret.get('Second', 'Test-1'), obj1)
396 self.assertEqual(type(ret.get('Second')), list)
397 self.assertEqual(
398 type(ret.get('Second', re.compile(r'Test-[0-9]'))), list)
399 self.assertEqual(len(ret.get('Second', re.compile(r'Test-[0-9]'))), 1)
400 self.assertEqual(
401 len(ret.get('Second', re.compile(r'Test-[0-9]'), True)), 2)
402

◆ test37_BookkeepUpdatedObjects()

test_dal.DalTest.test37_BookkeepUpdatedObjects ( self)

Definition at line 403 of file test_dal.py.

403 def test37_BookkeepUpdatedObjects(self):
404 db = conffwk.Configuration('oksconflibs:test.data.xml')
405 obj = db.get_dal('Dummy', 'Test-3')
407 self.assertEqual(len(conffwk.updated_dals()), 0)
408 obj.bool = False
409 self.assertEqual(len(conffwk.updated_dals()), 1)
410 self.assertEqual(conffwk.updated_dals(), set((obj,)))
411 obj.sint8 = 0
412 self.assertEqual(len(conffwk.updated_dals()), 1)
413
414 obj1 = db.get_dal('Second', 'Test-1')
415 self.assertEqual(len(conffwk.updated_dals()), 1)
416
417 obj1.bool = False
418 self.assertEqual(len(conffwk.updated_dals()), 2)
419 self.assertEqual(conffwk.updated_dals(), set((obj, obj1)))
420
reset_updated_dals()
Definition __init__.py:20
updated_dals()
Definition __init__.py:13

◆ test38_CanRename()

test_dal.DalTest.test38_CanRename ( self)

Definition at line 421 of file test_dal.py.

421 def test38_CanRename(self):
422 db = conffwk.Configuration('oksconflibs:test.data.xml')
423 obj = db.get_dal('Dummy', 'Test-3')
424 obj.rename('Test-4')
425 db.update_dal(obj)
426 obj2 = db.get_dal('Dummy', 'Test-4')
427 self.assertEqual(obj, obj2)
428 db.commit()
429
430

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