def test_metadata_grid_size(self, plate_wells, conn): """ Check that the grid represented in the metadata is the correct size """ plate_grid = PlateGrid(conn, plate_wells.id.val, 0) assert len(plate_grid.metadata['grid']) == 8 assert len(plate_grid.metadata['grid'][0]) == 12
def test_instantiation(self, plate_wells, conn): """ Check that the helper object can be created """ plate_grid = PlateGrid(conn, plate_wells.id.val, 0) assert plate_grid assert plate_grid.plate.id == plate_wells.id.val assert plate_grid.field == 0
def test_description(self, plate_wells_with_description, conn): """ Check that an images description is included with the grid metadata """ plate = plate_wells_with_description['plate'] description = plate_wells_with_description['description'] plate_grid = PlateGrid(conn, plate.id.val, 0) metadata = plate_grid.metadata assert metadata['grid'][0][0]['description'] == description
def test_creation_date(self, plate_wells_with_no_acq_date, conn): """ Check that plate grid metadata falls back to using creation event time if an image has no (or an invalid) acquistion date """ plate = plate_wells_with_no_acq_date['plate'] creation_date = plate_wells_with_no_acq_date['creation_date'] plate_grid = PlateGrid(conn, plate.id.val, 0) metadata = plate_grid.metadata assert metadata['grid'][0][0]['date'] == creation_date
def test_acquisition_date(self, plate_wells_with_acq_date, conn): """ Check that acquisition date is used for an image in the plate if it is specified """ plate = plate_wells_with_acq_date['plate'] acq_date = plate_wells_with_acq_date['acq_date'] plate_grid = PlateGrid(conn, plate.id.val, 0) metadata = plate_grid.metadata assert metadata['grid'][0][0]['date'] == acq_date
def test_metadata_thumbnail_url(self, plate_wells, conn): """ Check that extra elements of the thumbnail URL passed in the `xtra` dictionary are properly prepended """ plate_grid = PlateGrid(conn, plate_wells.id.val, 0, 'foo/bar/') metadata = plate_grid.metadata for well in plate_wells.copyWells(): well_metadata = metadata['grid'][well.row.val][well.column.val] if well_metadata: assert well_metadata['thumb_url'].startswith('foo/bar/')
def test_full_grid(self, full_plate_wells, conn): """ Check that all wells are assigned correctly even if the entire plate of wells is full """ lett = map(chr, range(ord('A'), ord('Z') + 1)) plate_grid = PlateGrid(conn, full_plate_wells.id.val, 0) metadata = plate_grid.metadata for row in range(8): for column in range(12): assert metadata['grid'][row][column]['name'] ==\ lett[row]+str(column) assert metadata['grid'][row][column]['description'] == ''