mild-blue / txmatching

Solver for kidney pair donation matching problems.
https://txm.demo.mild.blue
Other
2 stars 2 forks source link

Make test_swagger_endpoints more verbose. #1240

Open abragtim opened 1 year ago

abragtim commented 1 year ago

Teď když uděláte chybu ve swaggeru jako tady https://github.com/mild-blue/txmatching/pull/1235#discussion_r1243848161, tak uvidíte jen tohle

  File "/opt/conda/envs/txmatching/lib/python3.11/site-packages/swagger_unittest/swagger_tester/swagger_tester.py", line 87, in validate_definition
    assert len(set(valid_definition).intersection(actual_definition)) >= 1, (
AssertionError: Responses are not compatible. Definition of valid response is [] which is different than definition of actual response which is []. 
Cbc3007W No integer variables
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00

Valid response: {'hla_to_antibody': [{'antibody_matches': [{'hla_antibody': {'code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'A1', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:02', 'split': 'A1'}, 'display_code': 'A*01:02', 'raw_code': 'A*01:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:03', 'split': 'A1'}, 'display_code': 'A*01:03', 'raw_code': 'A*01:03'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:06', 'split': 'A1'}, 'display_code': 'A*01:06', 'raw_code': 'A*01:06'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:19', 'split': 'A1'}, 'display_code': 'A*01:19', 'raw_code': 'A*01:19'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A2', 'high_res': None, 'split': 'A2'}, 'display_code': 'A2', 'raw_code': 'A2'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'cutoff': 2000, 'mfi': 2000, 'raw_code': 'B7', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'display_code': 'B7', 'raw_code': 'B7'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 2000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B35', 'high_res': None, 'split': 'B35'}, 'display_code': 'B35', 'raw_code': 'B35'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DR15', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:03', 'split': 'DR15'}, 'display_code': 'DRB1*15:03', 'raw_code': 'DRB1*15:03'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:112', 'split': 'DR15'}, 'display_code': 'DRB1*15:112', 'raw_code': 'DRB1*15:112'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:07', 'split': 'DR15'}, 'display_code': 'DRB1*15:07', 'raw_code': 'DRB1*15:07'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:02', 'split': 'DR11'}, 'display_code': 'DRB1*11:02', 'raw_code': 'DRB1*11:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:15', 'split': 'DR11'}, 'display_code': 'DRB1*11:15', 'raw_code': 'DRB1*11:15'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:52', 'split': 'DR11'}, 'display_code': 'DRB1*11:52', 'raw_code': 'DRB1*11:52'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DPA2', 'high_res': 'DPA1*02:01', 'split': 'DPA2'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DPA1*02:01', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'display_code': 'DPA2', 'raw_code': 'DPA2'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DP1054', 'high_res': None, 'split': 'DP1054'}, 'display_code': 'DP1054', 'raw_code': 'DP1054'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQA1', 'high_res': None, 'split': 'DQA1'}, 'display_code': 'DQA1', 'raw_code': 'DQA1'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQ1', 'high_res': None, 'split': 'DQ6'}, 'display_code': 'DQ6', 'raw_code': 'DQ6'}, 'is_frequent': True}], 'summary': None}], 'parsing_issues': [{'hla_code_or_group': 'A*01:06', 'message': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.', 'parsing_issue_detail': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.'}]} 
Actual response: {'hla_to_antibody': [{'antibody_matches': [{'hla_antibody': {'code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'A1', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:02', 'split': 'A1'}, 'display_code': 'A*01:02', 'raw_code': 'A*01:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:03', 'split': 'A1'}, 'display_code': 'A*01:03', 'raw_code': 'A*01:03'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:06', 'split': 'A1'}, 'display_code': 'A*01:06', 'raw_code': 'A*01:06'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'A1', 'high_res': 'A*01:19', 'split': 'A1'}, 'display_code': 'A*01:19', 'raw_code': 'A*01:19'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'A1', 'high_res': None, 'split': 'A1'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'A2', 'high_res': None, 'split': 'A2'}, 'display_code': 'A2', 'raw_code': 'A2'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'cutoff': 2000, 'mfi': 2000, 'raw_code': 'B7', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'display_code': 'B7', 'raw_code': 'B7'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'B7', 'high_res': None, 'split': 'B7'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 2000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'B35', 'high_res': None, 'split': 'B35'}, 'display_code': 'B35', 'raw_code': 'B35'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DR15', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:03', 'split': 'DR15'}, 'display_code': 'DRB1*15:03', 'raw_code': 'DRB1*15:03'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:112', 'split': 'DR15'}, 'display_code': 'DRB1*15:112', 'raw_code': 'DRB1*15:112'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR2', 'high_res': 'DRB1*15:07', 'split': 'DR15'}, 'display_code': 'DRB1*15:07', 'raw_code': 'DRB1*15:07'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DR2', 'high_res': None, 'split': 'DR15'}, 'issues': ['Antibodies against this HLA Type might not be DSA, for more see detailed section.'], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:02', 'split': 'DR11'}, 'display_code': 'DRB1*11:02', 'raw_code': 'DRB1*11:02'}, 'is_frequent': True}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:15', 'split': 'DR11'}, 'display_code': 'DRB1*11:15', 'raw_code': 'DRB1*11:15'}, 'is_frequent': False}, {'hla_type': {'code': {'broad': 'DR5', 'high_res': 'DRB1*11:52', 'split': 'DR11'}, 'display_code': 'DRB1*11:52', 'raw_code': 'DRB1*11:52'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [{'hla_antibody': {'code': {'broad': 'DPA2', 'high_res': 'DPA1*02:01', 'split': 'DPA2'}, 'cutoff': 2000, 'mfi': 3000, 'raw_code': 'DPA1*02:01', 'second_code': None, 'second_raw_code': None, 'type': 'NORMAL'}, 'match_type': 'SPLIT'}], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'display_code': 'DPA2', 'raw_code': 'DPA2'}, 'is_frequent': True}], 'summary': {'hla_code': {'broad': 'DPA2', 'high_res': None, 'split': 'DPA2'}, 'issues': [], 'match_type': 'SPLIT', 'mfi': 3000}}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DP1054', 'high_res': None, 'split': 'DP1054'}, 'display_code': 'DP1054', 'raw_code': 'DP1054'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQA1', 'high_res': None, 'split': 'DQA1'}, 'display_code': 'DQA1', 'raw_code': 'DQA1'}, 'is_frequent': True}], 'summary': None}, {'antibody_matches': [], 'assumed_hla_types': [{'hla_type': {'code': {'broad': 'DQ1', 'high_res': None, 'split': 'DQ6'}, 'display_code': 'DQ6', 'raw_code': 'DQ6'}, 'is_frequent': True}], 'summary': None}], 'parsing_issues': [{'hla_code_or_group': 'A*01:06', 'message': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.', 'parsing_issue_detail': 'The information about the serological equivalent of the allele is only assumed in our datasource so the conversion is not 100% reliable. Please check that the conversion is correct.'}]}

A myslíte si, že tenhle obrovský text nějak pomůže? Všichni si tak myslí na začátku, ale pak narazí na "The two files are identical" a z toho momentu Váš osobní boj začíná.

Cílem tohoto issue je udělat ten test informativnější na chyby, aby ukazoval určitý důvod, proč padá. Příklad takové situace je tady #1235 .

kubantjan commented 1 year ago

@abragtim to jak pises "priklad takove situace je tady" Neni za me moc srozumitelny, kde tady je priklad ty situace? Muzes to prosim lip vyspecifikovat?