# HG changeset patch # User fsavard # Date 1268402560 18000 # Node ID bfe20d63f88c0bb3f09b9970d1c51ecc2e92c283 # Parent eb78a695ad7ade7b12a951968167738cc80922de Test pour cas sans index, après question de James diff -r eb78a695ad7a -r bfe20d63f88c utils/seriestables/test_series.py --- a/utils/seriestables/test_series.py Thu Mar 11 16:29:39 2010 -0500 +++ b/utils/seriestables/test_series.py Fri Mar 12 09:02:40 2010 -0500 @@ -65,6 +65,33 @@ assert compare_lists(table.cols.minibatch[:], [1,2,1,2]) assert compare_lists(table.cols.validation_error[:], [32.0, 30.0, 28.0, 26.0]) +def test_ErrorSeries_no_index(h5f=None): + if not h5f: + h5f_path = tempfile.NamedTemporaryFile().name + h5f = tables.openFile(h5f_path, "w") + + validation_error = series.ErrorSeries(error_name="validation_error", + table_name="validation_error", + hdf5_file=h5f, + # empty tuple + index_names=tuple(), + title="Validation error with no index") + + # (1,1), (1,2) etc. are (epoch, minibatch) index + validation_error.append(tuple(), 32.0) + validation_error.append(tuple(), 30.0) + validation_error.append(tuple(), 28.0) + validation_error.append(tuple(), 26.0) + + h5f.close() + + h5f = tables.openFile(h5f_path, "r") + + table = h5f.getNode('/', 'validation_error') + + assert compare_lists(table.cols.validation_error[:], [32.0, 30.0, 28.0, 26.0]) + assert not ("epoch" in dir(table.cols)) + def test_ErrorSeries_notimestamp(h5f=None): if not h5f: h5f_path = tempfile.NamedTemporaryFile().name