Beispiel #1
0
 def test_persist_with_location(self, nested_session, tube_rack_fac,
                                barcoded_location_c127s8):
     tr = tube_rack_fac()
     tr.location = barcoded_location_c127s8
     kw = tube_rack_fac.init_kw.copy()
     kw['location'] = barcoded_location_c127s8
     persist(nested_session, tr, kw, True)
Beispiel #2
0
 def test_persist_all_attributes(
         self, request, nested_session, iso_fac_name, iso_job_fac,
         iso_stock_rack_fac, iso_sector_stock_rack_fac,
         iso_preparation_plate_fac, iso_plate1, iso_plate2, iso_plate3,
         iso_aliquot_plate_fac, iso_sector_preparation_plate_fac,
         rack_layout_fac):
     iso_fac = request.getfuncargvalue(iso_fac_name)
     rl1 = rack_layout_fac.new()
     iso = iso_fac(rack_layout=rl1)
     iso_job = iso_job_fac(isos=[iso])
     assert iso.iso_job.label == iso_job.label
     kw = iso_fac.init_kw
     kw['rack_layout'] = rl1
     iso_stock_rack = iso_stock_rack_fac(iso=iso,
                                         rack_layout=rack_layout_fac.new())
     assert len(iso.iso_stock_racks) == 1
     kw['iso_stock_racks'] = [iso_stock_rack]
     iso_sector_stock_rack = iso_sector_stock_rack_fac(
         iso=iso, rack_layout=rack_layout_fac.new())
     assert len(iso.iso_sector_stock_racks) == 1
     kw['iso_sector_stock_racks'] = [iso_sector_stock_rack]
     iso_preparation_plate = iso_preparation_plate_fac(
         iso=iso, rack=iso_plate1, rack_layout=rack_layout_fac.new())
     assert len(iso.iso_preparation_plates) == 1
     kw['iso_preparation_plates'] = [iso_preparation_plate]
     iso_aliquot_plate = iso_aliquot_plate_fac(iso=iso, rack=iso_plate2)
     assert len(iso.iso_aliquot_plates) == 1
     kw['iso_aliquot_plates'] = [iso_aliquot_plate]
     if iso_fac_name == 'stock_sample_creation_iso_fac':
         iso_sector_prep_plate = iso_sector_preparation_plate_fac(
             iso=iso, rack=iso_plate3, rack_layout=rack_layout_fac.new())
         assert len(iso.iso_sector_preparation_plates) == 1
         kw['iso_sector_preparation_plates'] = [iso_sector_prep_plate]
     persist(nested_session, iso, kw, True)
 def test_persist(self, request, nested_session, fac_name):
     fac = request.getfuncargvalue(fac_name)
     md = fac()
     # The attribute check fails occasionally for molecules with more than
     # one chemical structure because the structures are kept in a list
     # and the retrieval order is undefined.
     persist(nested_session, md, fac.init_kw, False)
Beispiel #4
0
 def test_persist(self, nested_session, worklist_series_fac,
                  planned_worklist_fac):
     ws = worklist_series_fac()
     pwl = planned_worklist_fac()
     ws.add_worklist(0, pwl)
     attrs = dict(planned_worklists=[pwl])
     persist(nested_session, ws, attrs, True)
Beispiel #5
0
 def test_persist(self, request, nested_session,
                  planned_liquid_transfer_fac_name):
     planned_liquid_transfer_fac = \
         request.getfuncargvalue(planned_liquid_transfer_fac_name)
     plt = planned_liquid_transfer_fac()
     persist(nested_session, plt, planned_liquid_transfer_fac.init_kw,
             True)
Beispiel #6
0
 def test_persist(self, nested_session, worklist_series_fac,
                  planned_worklist_fac):
     ws = worklist_series_fac()
     pwl = planned_worklist_fac()
     ws.add_worklist(0, pwl)
     attrs = dict(planned_worklists=[pwl])
     persist(nested_session, ws, attrs, True)
Beispiel #7
0
 def test_persist(self, request, nested_session, fac_name):
     fac = request.getfuncargvalue(fac_name)
     md = fac()
     # The attribute check fails occasionally for molecules with more than
     # one chemical structure because the structures are kept in a list
     # and the retrieval order is undefined.
     persist(nested_session, md, fac.init_kw, False)
Beispiel #8
0
 def test_persist(self, nested_session, experiment_fac, experiment_job_fac):
     exp = experiment_fac()
     # FIXME: Working around the circular dependency of experiment and
     #        experiment job here.
     exp_job = experiment_job_fac(experiments=[exp])
     kw = experiment_fac.init_kw
     kw['job'] = exp.job
     exp.job = exp_job
     persist(nested_session, exp, kw, True)
Beispiel #9
0
 def test_persist(self, nested_session, experiment_fac,
                  experiment_job_fac):
     exp = experiment_fac()
     # FIXME: Working around the circular dependency of experiment and
     #        experiment job here.
     exp_job = experiment_job_fac(experiments=[exp])
     kw = experiment_fac.init_kw
     kw['job'] = exp.job
     exp.job = exp_job
     persist(nested_session, exp, kw, True)
Beispiel #10
0
 def test_persist(self, nested_session,
                  stock_sample_creation_iso_request_fac,
                  molecule_design_library_fac):
     ssir1 = stock_sample_creation_iso_request_fac()
     persist(nested_session, ssir1,
             stock_sample_creation_iso_request_fac.init_kw, True)
     kw = stock_sample_creation_iso_request_fac.init_kw
     kw['molecule_design_library'] = molecule_design_library_fac()
     ssir = stock_sample_creation_iso_request_fac(**kw)
     persist(nested_session, ssir, kw, True)
Beispiel #11
0
 def test_persist(self, nested_session,
                  stock_sample_creation_iso_request_fac,
                  molecule_design_library_fac):
     ssir1 = stock_sample_creation_iso_request_fac()
     persist(nested_session, ssir1,
             stock_sample_creation_iso_request_fac.init_kw,
             True)
     kw = stock_sample_creation_iso_request_fac.init_kw
     kw['molecule_design_library'] = molecule_design_library_fac()
     ssir = stock_sample_creation_iso_request_fac(**kw)
     persist(nested_session, ssir, kw, True)
Beispiel #12
0
 def test_persist_all_attributes(self, nested_session, iso_job_fac,
                                 iso_job_stock_rack_fac,
                                 iso_job_preparation_plate_fac):
     ij = iso_job_fac()
     kw = iso_job_fac.init_kw
     ijsr = iso_job_stock_rack_fac(iso_job=ij)
     assert len(ij.iso_job_stock_racks) == 1
     kw['iso_job_stock_racks'] = [ijsr]
     ijpp = iso_job_preparation_plate_fac(iso_job=ij)
     assert len(ij.iso_job_preparation_plates) == 1
     kw['iso_job_preparation_plates'] = [ijpp]
     persist(nested_session, ij, kw, True)
Beispiel #13
0
 def test_persist_all_attributes(self, nested_session, iso_job_fac,
                                 iso_job_stock_rack_fac,
                                 iso_job_preparation_plate_fac):
     ij = iso_job_fac()
     kw = iso_job_fac.init_kw
     ijsr = iso_job_stock_rack_fac(iso_job=ij)
     assert len(ij.iso_job_stock_racks) == 1
     kw['iso_job_stock_racks'] = [ijsr]
     ijpp = iso_job_preparation_plate_fac(iso_job=ij)
     assert len(ij.iso_job_preparation_plates) == 1
     kw['iso_job_preparation_plates'] = [ijpp]
     persist(nested_session, ij, kw, True)
Beispiel #14
0
 def test_convert_from_sample(self, nested_session, sample_fac, tube_fac,
                              molecule_fac):
     container = tube_fac()
     sample = sample_fac(container=container)
     molecule = molecule_fac()
     sm = sample.make_sample_molecule(molecule, 1e-5)
     assert sm in sample.sample_molecules
     # Needs to be in the session or else the conversion will fail.
     nested_session.add(type(sample), sample)
     sample.convert_to_stock_sample()
     attrs = dict(id=sample.id,
                  supplier=sample.supplier,
                  molecule_design_pool=sample.molecule_design_pool,
                  concentration=sample.concentration,
                  molecule_type=sample.molecule_type)
     persist(nested_session, sample, attrs, True)
Beispiel #15
0
 def test_convert_from_sample(self, nested_session,
                              sample_fac,
                              tube_fac, molecule_fac):
     container = tube_fac()
     sample = sample_fac(container=container)
     molecule = molecule_fac()
     sm = sample.make_sample_molecule(molecule, 1e-5)
     assert sm in sample.sample_molecules
     # Needs to be in the session or else the conversion will fail.
     nested_session.add(type(sample), sample)
     sample.convert_to_stock_sample()
     attrs = dict(id=sample.id,
                  supplier=sample.supplier,
                  molecule_design_pool=sample.molecule_design_pool,
                  concentration=sample.concentration,
                  molecule_type=sample.molecule_type
                  )
     persist(nested_session, sample, attrs, True)
Beispiel #16
0
 def test_persist_all_attributes(self, request, nested_session,
                                 iso_fac_name,
                                 iso_job_fac, iso_stock_rack_fac,
                                 iso_sector_stock_rack_fac,
                                 iso_preparation_plate_fac, iso_plate1,
                                 iso_plate2, iso_plate3,
                                 iso_aliquot_plate_fac,
                                 iso_sector_preparation_plate_fac,
                                 rack_layout_fac):
     iso_fac = request.getfuncargvalue(iso_fac_name)
     rl1 = rack_layout_fac.new()
     iso = iso_fac(rack_layout=rl1)
     iso_job = iso_job_fac(isos=[iso])
     assert iso.iso_job.label == iso_job.label
     kw = iso_fac.init_kw
     kw['rack_layout'] = rl1
     iso_stock_rack = iso_stock_rack_fac(iso=iso,
                                         rack_layout=rack_layout_fac.new())
     assert len(iso.iso_stock_racks) == 1
     kw['iso_stock_racks'] = [iso_stock_rack]
     iso_sector_stock_rack = iso_sector_stock_rack_fac(
                                         iso=iso,
                                         rack_layout=rack_layout_fac.new())
     assert len(iso.iso_sector_stock_racks) == 1
     kw['iso_sector_stock_racks'] = [iso_sector_stock_rack]
     iso_preparation_plate = iso_preparation_plate_fac(
                                         iso=iso,
                                         rack=iso_plate1,
                                         rack_layout=rack_layout_fac.new())
     assert len(iso.iso_preparation_plates) == 1
     kw['iso_preparation_plates'] = [iso_preparation_plate]
     iso_aliquot_plate = iso_aliquot_plate_fac(iso=iso,
                                               rack=iso_plate2)
     assert len(iso.iso_aliquot_plates) == 1
     kw['iso_aliquot_plates'] = [iso_aliquot_plate]
     if iso_fac_name == 'stock_sample_creation_iso_fac':
         iso_sector_prep_plate = iso_sector_preparation_plate_fac(
                                         iso=iso,
                                         rack=iso_plate3,
                                         rack_layout=rack_layout_fac.new())
         assert len(iso.iso_sector_preparation_plates) == 1
         kw['iso_sector_preparation_plates'] = [iso_sector_prep_plate]
     persist(nested_session, iso, kw, True)
Beispiel #17
0
 def test_persist_all_attributes(self, nested_session,
                                 worklist_series_member_fac,
                                 executed_worklist_fac):
     wsm = worklist_series_member_fac()
     pwl = wsm.planned_worklist
     assert not pwl.worklist_series is None
     assert not pwl.index is None
     assert len(pwl.executed_worklists) == 0
     ewl = executed_worklist_fac(planned_worklist=pwl)
     assert ewl.planned_worklist is pwl
     assert len(pwl.executed_worklists) == 1
     attrs = dict(executed_worklists=pwl.executed_worklists,
                  index=pwl.index,
                  worklist_series=pwl.worklist_series)
     pwl_from_storage = persist(nested_session, pwl, attrs, True)
     assert pwl_from_storage.worklist_series_member == wsm
Beispiel #18
0
 def test_persist_all_attributes(self, nested_session,
                                 worklist_series_member_fac,
                                 executed_worklist_fac):
     wsm = worklist_series_member_fac()
     pwl = wsm.planned_worklist
     assert not pwl.worklist_series is None
     assert not pwl.index is None
     assert len(pwl.executed_worklists) == 0
     ewl = executed_worklist_fac(planned_worklist=pwl)
     assert ewl.planned_worklist is pwl
     assert len(pwl.executed_worklists) == 1
     attrs = dict(executed_worklists=pwl.executed_worklists,
                  index=pwl.index,
                  worklist_series=pwl.worklist_series)
     pwl_from_storage = persist(nested_session, pwl, attrs, True)
     assert pwl_from_storage.worklist_series_member == wsm
Beispiel #19
0
 def test_persist_with_iso(self, nested_session, library_plate_fac,
                           lab_iso_fac):
     kw = library_plate_fac.init_kw
     kw['lab_iso'] = lab_iso_fac()
     lp = library_plate_fac(**kw)
     persist(nested_session, lp, kw, True)
Beispiel #20
0
 def test_persist(self, nested_session, gene_fac):
     gene = gene_fac()
     # The gene table is a materialized view; we should not be able to
     # insert new records here.
     with pytest.raises(IntegrityError):
         persist(nested_session, gene, gene_fac.init_kw, True)
Beispiel #21
0
 def test_persist(self, nested_session, tube_transfer_worklist_fac):
     ttwl = tube_transfer_worklist_fac()
     persist(nested_session, ttwl, tube_transfer_worklist_fac.init_kw,
             True)
Beispiel #22
0
 def test_persist(self, nested_session, molecule_design_library_fac):
     mdl = molecule_design_library_fac()
     persist(nested_session, mdl, molecule_design_library_fac.init_kw,
             True)
Beispiel #23
0
 def _test_persist(self):
     with RdbContextManager() as session:
         attrs = self._get_data()
         persist(session, self.entity_class, attrs, True)
Beispiel #24
0
 def test_persist(self, nested_session, item_status_fac):
     its = item_status_fac()
     persist(nested_session, its, item_status_fac.init_kw, True)
Beispiel #25
0
 def test_persist(self, nested_session, sample_molecule_fac):
     sm = sample_molecule_fac()
     persist(nested_session, sm, sample_molecule_fac.init_kw, True)
Beispiel #26
0
 def test_persist(self, nested_session, rack_position_set_fac):
     rps = rack_position_set_fac()
     persist(nested_session, rps, rack_position_set_fac.init_kw, True)
Beispiel #27
0
 def test_persist(self, nested_session, barcoded_location_fac):
     bl = barcoded_location_fac()
     kw = barcoded_location_fac.init_kw
     # FIXME: This should not be necessary.
     bl.type = kw['type'] = bl.type.name
     persist(nested_session, bl, kw, True)
Beispiel #28
0
 def test_persist(self, nested_session, lab_iso_request_fac):
     lir = lab_iso_request_fac()
     persist(nested_session, lir, lab_iso_request_fac.init_kw, True)
Beispiel #29
0
 def test_persist(self, nested_session, tube_transfer_worklist_fac):
     ttwl = tube_transfer_worklist_fac()
     persist(nested_session, ttwl, tube_transfer_worklist_fac.init_kw, True)
Beispiel #30
0
 def test_persist(self, nested_session, tube_transfer_fac):
     tt = tube_transfer_fac()
     persist(nested_session, tt, tube_transfer_fac.init_kw, True)
Beispiel #31
0
 def test_persist(self, nested_session, barcoded_location_fac):
     bl = barcoded_location_fac()
     kw = barcoded_location_fac.init_kw
     # FIXME: This should not be necessary.
     bl.type = kw['type'] = bl.type.name
     persist(nested_session, bl, kw, True)
Beispiel #32
0
 def test_persist(self, request, nested_session, stock_rack_fac_name):
     stock_rack_fac = request.getfuncargvalue(stock_rack_fac_name)
     sr = stock_rack_fac()
     persist(nested_session, sr, stock_rack_fac.init_kw, True)
Beispiel #33
0
 def test_persist(self, request, nested_session, iso_fac_name):
     iso_fac = request.getfuncargvalue(iso_fac_name)
     iso = iso_fac()
     persist(nested_session, iso, iso_fac.init_kw, True)
Beispiel #34
0
 def test_persist(self, nested_session, organization_fac):
     org = organization_fac()
     persist(nested_session, org, organization_fac.init_kw, True)
Beispiel #35
0
 def test_persist(self, request, nested_session, fac_name):
     fac = request.getfuncargvalue(fac_name)
     rack = fac()
     persist(nested_session, rack, fac.init_kw, True)
Beispiel #36
0
 def test_persist(self, nested_session, molecule_fac):
     mol = molecule_fac()
     persist(nested_session, mol, molecule_fac.init_kw, True)
Beispiel #37
0
 def test_persist(self, nested_session, user_preferences_fac):
     up = user_preferences_fac()
     persist(nested_session, up, user_preferences_fac.init_kw, True)
Beispiel #38
0
 def test_persist(self, nested_session, stock_sample_fac):
     sspl = stock_sample_fac()
     persist(nested_session, sspl, stock_sample_fac.init_kw, True)
Beispiel #39
0
 def test_persist(self, nested_session, rack_layout_fac):
     rl = rack_layout_fac()
     persist(nested_session, rl, rack_layout_fac.init_kw, True)
Beispiel #40
0
 def test_persist(self, nested_session, user_preferences_fac):
     up = user_preferences_fac()
     persist(nested_session, up, user_preferences_fac.init_kw, True)
Beispiel #41
0
 def test_persist(self, nested_session, rack_layout_fac):
     rl = rack_layout_fac()
     persist(nested_session, rl, rack_layout_fac.init_kw, True)
Beispiel #42
0
 def test_persist(self, nested_session, device_type_fac):
     dev_type = device_type_fac()
     persist(nested_session, dev_type, device_type_fac.init_kw, True)
Beispiel #43
0
 def test_persist(self, nested_session, molecule_design_pool_set_fac):
     mdps = molecule_design_pool_set_fac()
     persist(nested_session, mdps, molecule_design_pool_set_fac.init_kw,
             True)
Beispiel #44
0
 def test_persist(self, nested_session, tube_transfer_fac):
     tt = tube_transfer_fac()
     persist(nested_session, tt, tube_transfer_fac.init_kw, True)
Beispiel #45
0
 def test_persist(self, nested_session, stock_sample_fac):
     sspl = stock_sample_fac()
     persist(nested_session, sspl, stock_sample_fac.init_kw, True)
Beispiel #46
0
 def _test_persist(self):
     with RdbContextManager() as session:
         attrs = self._get_data()
         persist(session, self.entity_class, attrs, True)
Beispiel #47
0
 def test_persist(self, nested_session, experiment_design_fac):
     exp_design = experiment_design_fac()
     persist(nested_session, exp_design, experiment_design_fac.init_kw,
             True)
Beispiel #48
0
 def test_persist(self, nested_session, library_plate_fac):
     lp = library_plate_fac()
     persist(nested_session, lp, library_plate_fac.init_kw, True)
Beispiel #49
0
 def test_persist(self, nested_session, experiment_metadata_fac):
     exp_metadata = experiment_metadata_fac()
     persist(nested_session, exp_metadata, experiment_metadata_fac.init_kw,
             True)
Beispiel #50
0
 def test_persist(self, nested_session, project_fac):
     proj = project_fac()
     persist(nested_session, proj, project_fac.init_kw, True)
Beispiel #51
0
 def test_persist(self, nested_session, species_fac):
     spec = species_fac()
     persist(nested_session, spec, species_fac.init_kw, True)
Beispiel #52
0
 def test_persist(self, nested_session, sample_molecule_fac):
     sm = sample_molecule_fac()
     persist(nested_session, sm, sample_molecule_fac.init_kw, True)
Beispiel #53
0
 def test_persist(self, nested_session, molecule_type_fac):
     mt = molecule_type_fac()
     persist(nested_session, mt, molecule_type_fac.init_kw, True)
Beispiel #54
0
 def test_persist(self, nested_session, lab_iso_request_fac):
     lir = lab_iso_request_fac()
     persist(nested_session, lir, lab_iso_request_fac.init_kw, True)
Beispiel #55
0
 def test_persist(self, nested_session, organization_fac):
     org = organization_fac()
     persist(nested_session, org, organization_fac.init_kw, True)
Beispiel #56
0
 def test_persist(self, request, nested_session, iso_fac_name):
     iso_fac = request.getfuncargvalue(iso_fac_name)
     iso = iso_fac()
     persist(nested_session, iso, iso_fac.init_kw, True)
Beispiel #57
0
 def test_persist(self, request, nested_session, stock_rack_fac_name):
     stock_rack_fac = request.getfuncargvalue(stock_rack_fac_name)
     sr = stock_rack_fac()
     persist(nested_session, sr, stock_rack_fac.init_kw, True)