172 |
self.assert_(table is table.transient_table()) |
self.assert_(table is table.transient_table()) |
173 |
|
|
174 |
|
|
175 |
|
def test_transient_table_read_twice(self): |
176 |
|
"""Test TransientTable.read_record() reading the same record twice""" |
177 |
|
simple = SimpleTable([("type", FIELDTYPE_STRING), |
178 |
|
("code", FIELDTYPE_INT)], |
179 |
|
[("OTHER/UNKNOWN", 0), |
180 |
|
("RUINS", 1), |
181 |
|
("FARM", 2), |
182 |
|
("BUILDING", 3), |
183 |
|
("HUT", 4), |
184 |
|
("LIGHTHOUSE", 5)]) |
185 |
|
table = TransientTable(self.transientdb, simple) |
186 |
|
|
187 |
|
# There was a bug where reading the same record twice would |
188 |
|
# raise an exception in the second call because of an |
189 |
|
# unitialized local variable, so for passing the test it's |
190 |
|
# enough if reading simply succeeds. OTOH, while we're at it we |
191 |
|
# might as well check whether the results are equal anyway :) |
192 |
|
result1 = table.read_record(3) |
193 |
|
result2 = table.read_record(3) |
194 |
|
self.assertEquals(result1, result2) |
195 |
|
|
196 |
if __name__ == "__main__": |
if __name__ == "__main__": |
197 |
support.run_tests() |
support.run_tests() |