def test_getData(self): '''Ensure getData can extract and return correct data as a list of dict''' sample_reaction = openJson('Unit Tests/sample_brenda_reaction.json') returned_data = getData(sample_reaction, 'thioredoxin', DataType.turnover) for index, entry in enumerate(returned_data): self.assertDictEqual(returned_data[index], CopyData.expected_simple_return[index])
def test_get_molecular_weight_data_from_mixed(self): '''Ensure getData can extract specific activities data as a list of dict''' sample_reaction = openJson( 'Unit Tests/sample_mixed_brenda_reaction.json') returned_data = getData(sample_reaction, 'thioredoxin', DataType.molecular_weight) for index, entry in enumerate(returned_data): self.assertDictEqual( returned_data[index], CopyData.expected_molecular_weight_return[index])
def toEnzymeStructure_b(data_dict): '''Converts dictionary structure to DataTreatment.Enzyme based structure to be able to test data selection functions.''' organized_data = {} for enzyme in data_dict: organized_data[enzyme] = Enzyme(enzyme, '1.1.1.1') for metabolite in data_dict[enzyme]: organized_data[enzyme].backward[metabolite] = [] data = getData(data_dict[enzyme], metabolite, DataType.turnover) for index, entry in enumerate(data_dict[enzyme][metabolite]): organized_data[enzyme].backward[metabolite].append( MetaboliteCandidate(metabolite, **data[index])) return organized_data