def test_walker_create_fitsheader_inverted(session): tag = tables.Tag('foo') tag.id = 1 entries = walker.create(~FitsHeaderEntry('INSTRUME', 'EIT'), session) assert len(entries) == 9 assert entries == [ tables.DatabaseEntry(id=1, download_time=datetime(2005, 6, 15, 1)), tables.DatabaseEntry(id=2, starred=True, download_time=datetime(2005, 6, 15, 2)), tables.DatabaseEntry(id=3, path='/tmp', download_time=datetime(2005, 6, 15, 3)), tables.DatabaseEntry(id=4, starred=True, download_time=datetime(2005, 6, 15, 4)), tables.DatabaseEntry(id=5, tags=[tag], download_time=datetime(2005, 6, 15, 5)), tables.DatabaseEntry(id=6, starred=True, path='/tmp', download_time=datetime(2005, 6, 15, 6)), tables.DatabaseEntry(id=7, download_time=datetime(2005, 6, 15, 7)), tables.DatabaseEntry(id=8, starred=True, download_time=datetime(2005, 6, 15, 8)), tables.DatabaseEntry(id=9, path='/tmp', download_time=datetime(2005, 6, 15, 9)) ]
def test_walker_create_fitsheader(session): tag = tables.Tag('foo') tag.id = 1 entries = walker.create(FitsHeaderEntry('INSTRUME', 'EIT'), session) fits_header_entry = tables.FitsHeaderEntry('INSTRUME', 'EIT') fits_header_entry.id = 1 assert len(entries) == 1 assert entries == [tables.DatabaseEntry( id=10, starred=True, tags=[tag], download_time=datetime(2005, 6, 15, 10), fits_header_entries=[fits_header_entry])]
def test_fitsheaderentry_repr(): header_entry = FitsHeaderEntry('key', 'value') assert repr(header_entry) == "<FitsHeaderEntry('key', 'value')>" assert repr(~header_entry) == "<~FitsHeaderEntry('key', 'value')>"