214 |
auto.Title())) |
auto.Title())) |
215 |
|
|
216 |
|
|
217 |
|
def test_transient_joined_table_same_column_name(self): |
218 |
|
"""Test TransientJoinedTable join on columns with same name |
219 |
|
|
220 |
|
The transient DB maps the column names used by the tables to |
221 |
|
another set of names used only inside the SQLite database. There |
222 |
|
was a bug in the way this mapping was used when joining on |
223 |
|
fields with the same names in both tables so that the joined |
224 |
|
table ended up joining on the same column in the same table. |
225 |
|
""" |
226 |
|
mem_stretches = MemoryTable([("stretch_id", FIELDTYPE_INT)], |
227 |
|
[(i,) for i in range(4)]) |
228 |
|
stretches = AutoTransientTable(self.transientdb, mem_stretches) |
229 |
|
|
230 |
|
mem_discharges = MemoryTable([("disch_id", FIELDTYPE_INT), |
231 |
|
("stretch_id", FIELDTYPE_INT)], |
232 |
|
[(1, 0), (2, 3)]) |
233 |
|
discharges = AutoTransientTable(self.transientdb, mem_discharges) |
234 |
|
|
235 |
|
table = TransientJoinedTable(self.transientdb, stretches, "stretch_id", |
236 |
|
discharges, "stretch_id", |
237 |
|
outer_join = True) |
238 |
|
|
239 |
|
self.assertEquals(table.NumRows(), 4) |
240 |
|
self.assertEquals(table.NumColumns(), 2) |
241 |
|
|
242 |
|
# HasColumn |
243 |
|
self.failUnless(table.HasColumn("stretch_id")) |
244 |
|
self.failUnless(table.HasColumn("disch_id")) |
245 |
|
|
246 |
|
|
247 |
def test_transient_table_read_twice(self): |
def test_transient_table_read_twice(self): |
248 |
"""Test TransientTable.ReadRowAsDict() reading the same record twice""" |
"""Test TransientTable.ReadRowAsDict() reading the same record twice""" |
249 |
simple = MemoryTable([("type", FIELDTYPE_STRING), |
simple = MemoryTable([("type", FIELDTYPE_STRING), |