244 |
self.failUnless(table.HasColumn("disch_id")) |
self.failUnless(table.HasColumn("disch_id")) |
245 |
|
|
246 |
|
|
247 |
|
def test_transient_joined_table_with_equal_column_names(self): |
248 |
|
"""Test TransientJoinedTable join on tables with equal column names |
249 |
|
|
250 |
|
The join of two tables contains all fields from both tables instead |
251 |
|
th field the join was performed on. This special field is included |
252 |
|
once. If a name collision occurs for the field names, underscores are |
253 |
|
appended as long as any collision is resolved. |
254 |
|
""" |
255 |
|
mem_stretches = MemoryTable([("stretch_id", FIELDTYPE_INT), |
256 |
|
("name", FIELDTYPE_INT)], |
257 |
|
[(0, 10), (1, 11), (2, 12), (3, 13) ]) |
258 |
|
stretches = AutoTransientTable(self.transientdb, mem_stretches) |
259 |
|
|
260 |
|
mem_discharges = MemoryTable([("disch_id", FIELDTYPE_INT), |
261 |
|
("stretch_id", FIELDTYPE_INT), |
262 |
|
("name", FIELDTYPE_INT)], |
263 |
|
[(1, 0, 1), (2, 3, 2)]) |
264 |
|
discharges = AutoTransientTable(self.transientdb, mem_discharges) |
265 |
|
|
266 |
|
table = TransientJoinedTable(self.transientdb, stretches, "stretch_id", |
267 |
|
discharges, "stretch_id", |
268 |
|
outer_join = True) |
269 |
|
|
270 |
|
self.assertEquals(table.NumRows(), 4) |
271 |
|
self.assertEquals(table.NumColumns(), 4) |
272 |
|
|
273 |
|
# HasColumn |
274 |
|
self.failUnless(table.HasColumn("stretch_id")) |
275 |
|
self.failUnless(table.HasColumn("disch_id")) |
276 |
|
self.failUnless(table.HasColumn("name")) |
277 |
|
self.failUnless(table.HasColumn("name_")) |
278 |
|
|
279 |
|
|
280 |
def test_transient_table_read_twice(self): |
def test_transient_table_read_twice(self): |
281 |
"""Test TransientTable.ReadRowAsDict() reading the same record twice""" |
"""Test TransientTable.ReadRowAsDict() reading the same record twice""" |
282 |
simple = MemoryTable([("type", FIELDTYPE_STRING), |
simple = MemoryTable([("type", FIELDTYPE_STRING), |