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 34 of file test_dal.py.

Member Function Documentation

◆ test00_CanReadWriteBool()

test_dal.DalTest.test00_CanReadWriteBool ( self)

Definition at line 36 of file test_dal.py.

36 def test00_CanReadWriteBool(self):
37 obj = test.Dummy('Test-1')
38 test_good(self, obj, 'bool', [True, False, 0, 1])
39

◆ test01_CanReadWriteInt8()

test_dal.DalTest.test01_CanReadWriteInt8 ( self)

Definition at line 40 of file test_dal.py.

40 def test01_CanReadWriteInt8(self):
41 obj = test.Dummy('Test-1')
42 test_good(self, obj, 'sint8', [-2**7, 2**7-1, 0, 0xa])
43 test_bad(self, obj, 'sint8', [-2**7-1, 2**7, 0xab])
44

◆ test02_CanReadWriteUInt8()

test_dal.DalTest.test02_CanReadWriteUInt8 ( self)

Definition at line 45 of file test_dal.py.

45 def test02_CanReadWriteUInt8(self):
46 obj = test.Dummy('Test-1')
47 test_good(self, obj, 'uint8', [0, 2**8-1, 42, 0xab])
48 test_bad(self, obj, 'uint8', [-1, 2**8, 0xabc])
49

◆ test03_CanReadWriteInt16()

test_dal.DalTest.test03_CanReadWriteInt16 ( self)

Definition at line 50 of file test_dal.py.

50 def test03_CanReadWriteInt16(self):
51 obj = test.Dummy('Test-1')
52 test_good(self, obj, 'sint16', [-2**15, 2**15-1, 42, 0xa])
53 test_bad(self, obj, 'sint8', [-2**15-1, 2**15, 0xabcd])
54

◆ test04_CanReadWriteUInt16()

test_dal.DalTest.test04_CanReadWriteUInt16 ( self)

Definition at line 55 of file test_dal.py.

55 def test04_CanReadWriteUInt16(self):
56 obj = test.Dummy('Test-1')
57 test_good(self, obj, 'uint16', [0, 2**16-1, 42, 0xabcd])
58 test_bad(self, obj, 'uint16', [-1, 2**16, 0xabcde])
59

◆ test05_CanReadWriteInt32()

test_dal.DalTest.test05_CanReadWriteInt32 ( self)

Definition at line 60 of file test_dal.py.

60 def test05_CanReadWriteInt32(self):
61 obj = test.Dummy('Test-1')
62 test_good(self, obj, 'sint32', [-2**31, 2**31-1, 42, 0xa])
63 test_bad(self, obj, 'sint32', [-2**31-1, 2**31, 0xabcdabcdabcd])
64

◆ test06_CanReadWriteUInt32()

test_dal.DalTest.test06_CanReadWriteUInt32 ( self)

Definition at line 65 of file test_dal.py.

65 def test06_CanReadWriteUInt32(self):
66 obj = test.Dummy('Test-1')
67 test_good(self, obj, 'uint32', [0, 2**32-1, 42, 0xabcd])
68 test_bad(self, obj, 'uint32', [-1, 2**32, 0xabcdeabcdeabcde])
69

◆ test07_CanReadWriteInt64()

test_dal.DalTest.test07_CanReadWriteInt64 ( self)

Definition at line 70 of file test_dal.py.

70 def test07_CanReadWriteInt64(self):
71 obj = test.Dummy('Test-1')
72 test_good(self, obj, 'sint64', [-2**63, 2**63-1, 42, 0xa])
73 test_bad(self, obj, 'sint64', [-2**63-1,
74 2**63, 0xabcdabcdabcdabcabcabc])
75

◆ test08_CanReadWriteUInt64()

test_dal.DalTest.test08_CanReadWriteUInt64 ( self)

Definition at line 76 of file test_dal.py.

76 def test08_CanReadWriteUInt64(self):
77 obj = test.Dummy('Test-1')
78 test_good(self, obj, 'uint64', [0, 2**64-1, 42, 0xabcd])
79 test_bad(self, obj, 'uint64',
80 [-1, 2**64, 0xabcdeabcdeabcdeabcabcffabc])
81

◆ test09_CanReadWriteStringsWithRanges()

test_dal.DalTest.test09_CanReadWriteStringsWithRanges ( self)

Definition at line 82 of file test_dal.py.

82 def test09_CanReadWriteStringsWithRanges(self):
83 obj = test.Dummy('Test-1')
84 test_good(self, obj, 'string_vector', [
85 ['test01', 'test09'], ['test30']])
86 test_bad(self, obj, 'string_vector', [['Test01', 'test111'], ['abcd']])
87

◆ test10_CanReadWrite64bitVectors()

test_dal.DalTest.test10_CanReadWrite64bitVectors ( self)

Definition at line 88 of file test_dal.py.

88 def test10_CanReadWrite64bitVectors(self):
89 obj = test.Dummy('Test-1')
90 test_good(self, obj, 'uint64_vector', [[0, 1], [0]])
91 test_bad(self, obj, 'uint64_vector', [[0, -1], [2**65]])
92

◆ test11_CanReadWrite64bitVectorsAndWithRange()

test_dal.DalTest.test11_CanReadWrite64bitVectorsAndWithRange ( self)

Definition at line 93 of file test_dal.py.

93 def test11_CanReadWrite64bitVectorsAndWithRange(self):
94 obj = test.Dummy('Test-1')
95 test_good(self, obj, 'uint64_vector_range', [[18446744073709551600,
96 18446744073709551615],
97 [18446744073709551610]])
98 test_bad(self, obj, 'uint64_vector_range', [[0, -1], 10])
99

◆ test12_CanReadWriteEnum()

test_dal.DalTest.test12_CanReadWriteEnum ( self)

Definition at line 100 of file test_dal.py.

100 def test12_CanReadWriteEnum(self):
101 obj = test.Dummy('Test-1')
102 test_good(self, obj, 'enum', ['FIRST', 'SECOND'])
103 test_bad(self, obj, 'string_vector', ['first', 'zeroth'])
104

◆ test13_CanReadWriteDate()

test_dal.DalTest.test13_CanReadWriteDate ( self)

Definition at line 105 of file test_dal.py.

105 def test13_CanReadWriteDate(self):
106 obj = test.Dummy('Test-1')
107 test_good(self, obj, 'date', ['31/12/73', '01/01/70'])
108 test_bad(self, obj, 'date', ['31/00/19', '-1'])
109

◆ test14_CanReadWriteTime()

test_dal.DalTest.test14_CanReadWriteTime ( self)

Definition at line 110 of file test_dal.py.

110 def test14_CanReadWriteTime(self):
111 obj = test.Dummy('Test-1')
112 test_good(self, obj, 'time', [
113 '31/12/73 02:03:04', '01/01/70 00:00:59'])
114 test_bad(self, obj, 'time', ['31/12/73 24:23:22', '-1'])
115

◆ test15_CanReadWriteClassReference()

test_dal.DalTest.test15_CanReadWriteClassReference ( self)

Definition at line 116 of file test_dal.py.

116 def test15_CanReadWriteClassReference(self):
117 obj = test.Dummy('Test-1')
118 test_good(self, obj, 'classref', ['Dummy', 'Third'])
119 test_bad(self, obj, 'classref', ['DoesNotExistInDal'])
120

◆ test16_CanNotSetUnexistingAttribute()

test_dal.DalTest.test16_CanNotSetUnexistingAttribute ( self)

Definition at line 121 of file test_dal.py.

121 def test16_CanNotSetUnexistingAttribute(self):
122 obj = test.Dummy('Test-1')
123 self.assertRaises(AttributeError, setattr, obj, 'doesNotExist', 24)
124

◆ test17_AttributeInheritance()

test_dal.DalTest.test17_AttributeInheritance ( self)

Definition at line 125 of file test_dal.py.

125 def test17_AttributeInheritance(self):
126 obj = test.Third('Test-1')
127 test_good(self, obj, 'classref', ['Second', 'Third', 'Dummy'])
128 test_bad(self, obj, 'classref', ['DoesNotExistInDal'])
129

◆ test18_CanCompareDals()

test_dal.DalTest.test18_CanCompareDals ( self)

Definition at line 130 of file test_dal.py.

130 def test18_CanCompareDals(self):
131 obj1 = test.Dummy('Test-1')
132 obj2 = test.Dummy('Test-1')
133 self.assertEqual(obj1, obj2)
134 obj3 = test.Second('Test-1')
135 self.assertNotEqual(obj1, obj3)
136 obj4 = test.Dummy('Test-2')
137 self.assertNotEqual(obj1, obj4)
138

◆ test19_CanReadWriteSingleValuedRelations()

test_dal.DalTest.test19_CanReadWriteSingleValuedRelations ( self)

Definition at line 139 of file test_dal.py.

139 def test19_CanReadWriteSingleValuedRelations(self):
140 obj1 = test.Second('Test-1')
141 obj2 = test.Third('Test-2')
142 obj3 = test.Dummy('Test-3')
143 test_good(self, obj2, 'Single', [None, obj1])
144 test_bad(self, obj2, 'Single', [obj3, 4])
145

◆ test20_CanReadWriteMultiValuedRelations()

test_dal.DalTest.test20_CanReadWriteMultiValuedRelations ( self)

Definition at line 146 of file test_dal.py.

146 def test20_CanReadWriteMultiValuedRelations(self):
147 obj1 = test.Second('Test-1')
148 obj2 = test.Third('Test-2')
149 obj3 = test.Dummy('Test-3')
150 test_good(self, obj1, 'Dummy', [[], [obj3, obj2], [obj2]])
151 test_bad(self, obj2, 'Seconds', [[obj1, obj3]])
152

◆ test21_CanAttributeFromConstructor()

test_dal.DalTest.test21_CanAttributeFromConstructor ( self)

Definition at line 153 of file test_dal.py.

153 def test21_CanAttributeFromConstructor(self):
154 obj = test.Dummy('Test-1', string_vector=['test10', 'test20'])
155 self.assertEqual(obj.string_vector, ['test10', 'test20'])
156 obj2 = test.Second('Test-2', string_vector=['test20', 'test30'],
157 Dummy=[obj])
158 self.assertEqual(obj2.Dummy, [obj])
159

◆ test22_CanReadWriteDalOnConfiguration()

test_dal.DalTest.test22_CanReadWriteDalOnConfiguration ( self)

Definition at line 160 of file test_dal.py.

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

◆ test23_CanSearchForDalsAtConfiguration()

test_dal.DalTest.test23_CanSearchForDalsAtConfiguration ( self)

Definition at line 173 of file test_dal.py.

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

◆ test24_CanReadWriteBigDatabases()

test_dal.DalTest.test24_CanReadWriteBigDatabases ( self)

Definition at line 189 of file test_dal.py.

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

◆ test25_CanRecurseALot()

test_dal.DalTest.test25_CanRecurseALot ( self)

Definition at line 206 of file test_dal.py.

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

◆ test26_CanModifyDatabases()

test_dal.DalTest.test26_CanModifyDatabases ( self)

Definition at line 229 of file test_dal.py.

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

◆ test27_CanSearchUsingBaseClasses()

test_dal.DalTest.test27_CanSearchUsingBaseClasses ( self)

Definition at line 263 of file test_dal.py.

263 def test27_CanSearchUsingBaseClasses(self):
264 # reopen and check
265 db = conffwk.Configuration('oksconflibs:test.data.xml')
266 self.assertEqual(len(db.get_dals('Dummy')), RECURSION_TEST)
267

◆ test28_CanHandleInheritanceAtSearch()

test_dal.DalTest.test28_CanHandleInheritanceAtSearch ( self)

Definition at line 268 of file test_dal.py.

268 def test28_CanHandleInheritanceAtSearch(self):
269 # reopen and check
270 db = conffwk.Configuration('oksconflibs:test.data.xml')
271 objs = db.get_dals('Dummy')
272 self.assertEqual(len(objs), RECURSION_TEST)
273 for k in objs:
274 self.assertEqual(k.className(), 'Second')
275

◆ test29_CanWriteInfiniteRecursion()

test_dal.DalTest.test29_CanWriteInfiniteRecursion ( self)

Definition at line 276 of file test_dal.py.

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

◆ test30_CanReadInfiniteRecursion()

test_dal.DalTest.test30_CanReadInfiniteRecursion ( self)

Definition at line 286 of file test_dal.py.

286 def test30_CanReadInfiniteRecursion(self):
287 db = conffwk.Configuration('oksconflibs:test.data.xml')
288 obj1 = db.get_dal('Second', 'Obj-1')
289 obj2 = db.get_dal('Second', 'Obj-2')
290 self.assertEqual(obj1.Another, obj2)
291 self.assertEqual(obj2.Another, obj1)
292

◆ test31_CanWriteBiggerRecursion()

test_dal.DalTest.test31_CanWriteBiggerRecursion ( self)

Definition at line 293 of file test_dal.py.

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

◆ test32_CanReadBiggerRecursion()

test_dal.DalTest.test32_CanReadBiggerRecursion ( self)

Definition at line 307 of file test_dal.py.

307 def test32_CanReadBiggerRecursion(self):
308 db = conffwk.Configuration('oksconflibs:test.data.xml')
309 obj1 = db.get_dal('Second', 'Obj-1')
310 obj2 = db.get_dal('Second', 'Obj-2')
311 obj3 = db.get_dal('Second', 'Obj-3')
312 obj4 = db.get_dal('Second', 'Obj-4')
313 self.assertEqual(obj1.Another, obj2)
314 self.assertEqual(obj2.Another, obj3)
315 self.assertEqual(obj3.Another, obj4)
316 self.assertEqual(obj4.Another, obj1)
317

◆ test33_CanHandleDalDestruction()

test_dal.DalTest.test33_CanHandleDalDestruction ( self)

Definition at line 318 of file test_dal.py.

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

◆ test34_CanModifyNonRecursively()

test_dal.DalTest.test34_CanModifyNonRecursively ( self)

Definition at line 336 of file test_dal.py.

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

◆ test35_CannotMoveIfNotIncluded()

test_dal.DalTest.test35_CannotMoveIfNotIncluded ( self)

Definition at line 352 of file test_dal.py.

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

◆ test36_CanSearchForObjects()

test_dal.DalTest.test36_CanSearchForObjects ( self)

Definition at line 377 of file test_dal.py.

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

◆ test37_BookkeepUpdatedObjects()

test_dal.DalTest.test37_BookkeepUpdatedObjects ( self)

Definition at line 398 of file test_dal.py.

398 def test37_BookkeepUpdatedObjects(self):
399 db = conffwk.Configuration('oksconflibs:test.data.xml')
400 obj = db.get_dal('Dummy', 'Test-3')
402 self.assertEqual(len(conffwk.updated_dals()), 0)
403 obj.bool = False
404 self.assertEqual(len(conffwk.updated_dals()), 1)
405 self.assertEqual(conffwk.updated_dals(), set((obj,)))
406 obj.sint8 = 0
407 self.assertEqual(len(conffwk.updated_dals()), 1)
408
409 obj1 = db.get_dal('Second', 'Test-1')
410 self.assertEqual(len(conffwk.updated_dals()), 1)
411
412 obj1.bool = False
413 self.assertEqual(len(conffwk.updated_dals()), 2)
414 self.assertEqual(conffwk.updated_dals(), set((obj, obj1)))
415
updated_dals()
Definition __init__.py:8
reset_updated_dals()
Definition __init__.py:15

◆ test38_CanRename()

test_dal.DalTest.test38_CanRename ( self)

Definition at line 416 of file test_dal.py.

416 def test38_CanRename(self):
417 db = conffwk.Configuration('oksconflibs:test.data.xml')
418 obj = db.get_dal('Dummy', 'Test-3')
419 obj.rename('Test-4')
420 db.update_dal(obj)
421 obj2 = db.get_dal('Dummy', 'Test-4')
422 self.assertEqual(obj, obj2)
423 db.commit()
424
425

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