Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Daylily-Informatics_bloom /tests /test_init_objs.py
| from bloom_lims.domain import ( | |
| BloomContainer, | |
| BloomContainerPlate, | |
| BloomContent, | |
| BloomEquipment, | |
| BloomObj, | |
| ) | |
| from bloom_lims.tapdb_adapter import BLOOMdb3 | |
| ### | |
| # | |
| # This test DOES reflect appropriate initial use of the polymorphic ORM version now replacing earlier versions. | |
| # | |
| ### | |
| def _check_create_instances_ret_matrix(bobj_matrix, expected_lens=[None, None]): | |
| """ | |
| Check that the template creation function returns the correct number of objects | |
| One checking one level of nesting | |
| """ | |
| ret_check = False | |
| if len(bobj_matrix[0]) == expected_lens[0]: | |
| ret_check = True | |
| else: | |
| ret_check = False | |
| if len(bobj_matrix[1]) == expected_lens[1] and ret_check: | |
| ret_check = True | |
| else: | |
| ret_check = False | |
| return ret_check | |
| def test_intantiating_bloom_objects(): | |
| bdb = BLOOMdb3() | |
| cr = BloomContainer(bdb) | |
| assert cr.__class__.__name__ == "BloomContainer" | |
| crp = BloomContainerPlate(bdb) | |
| assert crp.__class__.__name__ == "BloomContainerPlate" | |
| ct = BloomContent(bdb) | |
| assert ct.__class__.__name__ == "BloomContent" | |
| eq = BloomEquipment(bdb) | |
| assert eq.__class__.__name__ == "BloomEquipment" | |
| def test_create_instances_from_instance_templates(): | |
| bdb = BLOOMdb3() | |
| bob = BloomObj(bdb) | |
| generic_templates = bdb.session.query(bob.Base.classes.generic_template).all() | |
| err = False | |
| for template in generic_templates: | |
| try: | |
| bob.create_instances(template.euid) | |
| except Exception: | |
| if template.type == "assay": | |
| pass # Expected to fail if already instantiated | |
| elif template.category == "test_requisition": | |
| pass # Retired category — templates may linger in DB but ORM class removed | |
| else: | |
| err = True | |
| raise Exception( | |
| f"Error creating instances for template: {template.name} ... {template.euid}" | |
| ) | |
| if err: | |
| raise Exception( | |
| "Error creating instances for template: {}".format(template.euid) | |
| ) | |
| else: | |
| assert 1 == 1 | |
Xet Storage Details
- Size:
- 2.14 kB
- Xet hash:
- e7c990d78a5ad8e608eb2cdb2e2f7b92e5db21d533bbd668c7be1a28686b83c7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.