File tree Expand file tree Collapse file tree 4 files changed +88
-84
lines changed
Expand file tree Collapse file tree 4 files changed +88
-84
lines changed Original file line number Diff line number Diff line change 1212
1313@requires_api_key
1414def test_absorption_search ():
15- client_search_testing (
16- search_method = AbsorptionRester ().search ,
17- excluded_params = [
18- "num_chunks" ,
19- "chunk_size" ,
20- "all_fields" ,
21- "fields" ,
22- ],
23- alt_name_dict = {
24- "material_ids" : "material_id" ,
25- "num_sites" : "nsites" ,
26- "num_elements" : "nelements" ,
27- "band_gap" : "bandgap" ,
28- },
29- custom_field_tests = {
30- "material_ids" : ["mp-149" , "mp-239" ],
31- "material_ids" : "mp-149" ,
32- "num_sites" : (6 , 7 ),
33- "num_sites" : 7 ,
34- "num_elements" : 5 ,
35- "num_elements" : (4 , 5 ),
36- "volume" : (115 , 116 ),
37- "volume" : 115.5 ,
38- "density" : (2.9 , 3 ),
39- "density" : 2.933 ,
40- "band_gap" : (1 , 1.05 ),
41- "band_gap" : 1.0 ,
42- },
43- sub_doc_fields = [],
44- )
15+ with AbsorptionRester () as rester :
16+ client_search_testing (
17+ search_method = rester .search ,
18+ excluded_params = [
19+ "num_chunks" ,
20+ "chunk_size" ,
21+ "all_fields" ,
22+ "fields" ,
23+ ],
24+ alt_name_dict = {
25+ "material_ids" : "material_id" ,
26+ "num_sites" : "nsites" ,
27+ "num_elements" : "nelements" ,
28+ "band_gap" : "bandgap" ,
29+ },
30+ custom_field_tests = {
31+ "material_ids" : ["mp-149" , "mp-239" ],
32+ "material_ids" : "mp-149" ,
33+ "num_sites" : (6 , 7 ),
34+ "num_sites" : 7 ,
35+ "num_elements" : 5 ,
36+ "num_elements" : (4 , 5 ),
37+ "volume" : (115 , 116 ),
38+ "volume" : 115.5 ,
39+ "density" : (2.9 , 3 ),
40+ "density" : 2.933 ,
41+ "band_gap" : (1 , 1.05 ),
42+ "band_gap" : 1.0 ,
43+ },
44+ sub_doc_fields = [],
45+ )
Original file line number Diff line number Diff line change 99
1010@requires_api_key
1111def test_alloys_search ():
12- client_search_testing (
13- search_method = AlloysRester ().search ,
14- excluded_params = [
15- "num_chunks" ,
16- "chunk_size" ,
17- "all_fields" ,
18- "fields" ,
19- ],
20- alt_name_dict = {
21- "material_ids" : "pair_id" ,
22- "formulae" : "alloy_pair" ,
23- },
24- custom_field_tests = {
25- "material_ids" : ["mp-70" , "mp-1014212" ],
26- "material_ids" : "mp-1014212" ,
27- "formulae" : ["Rb" , "Si" ],
28- },
29- sub_doc_fields = [],
30- )
12+ with AlloysRester () as rester :
13+ client_search_testing (
14+ search_method = rester .search ,
15+ excluded_params = [
16+ "num_chunks" ,
17+ "chunk_size" ,
18+ "all_fields" ,
19+ "fields" ,
20+ ],
21+ alt_name_dict = {
22+ "material_ids" : "pair_id" ,
23+ "formulae" : "alloy_pair" ,
24+ },
25+ custom_field_tests = {
26+ "material_ids" : ["mp-70" , "mp-1014212" ],
27+ "material_ids" : "mp-1014212" ,
28+ "formulae" : ["Rb" , "Si" ],
29+ },
30+ sub_doc_fields = [],
31+ )
Original file line number Diff line number Diff line change 55
66@requires_api_key
77def test_doi_search ():
8- client_search_testing (
9- search_method = DOIRester ().search ,
10- excluded_params = [
11- "num_chunks" ,
12- "chunk_size" ,
13- "all_fields" ,
14- "fields" ,
15- ],
16- alt_name_dict = {
17- "material_ids" : "material_id" ,
18- },
19- custom_field_tests = {
20- "material_ids" : ["mp-149" , "mp-13" ],
21- "material_ids" : "mp-149" ,
22- },
23- sub_doc_fields = [],
24- )
8+ with DOIRester () as rester :
9+ client_search_testing (
10+ search_method = rester .search ,
11+ excluded_params = [
12+ "num_chunks" ,
13+ "chunk_size" ,
14+ "all_fields" ,
15+ "fields" ,
16+ ],
17+ alt_name_dict = {
18+ "material_ids" : "material_id" ,
19+ },
20+ custom_field_tests = {
21+ "material_ids" : ["mp-149" , "mp-13" ],
22+ "material_ids" : "mp-149" ,
23+ },
24+ sub_doc_fields = [],
25+ )
Original file line number Diff line number Diff line change 1313
1414@requires_api_key
1515def test_phonon_search ():
16- client_search_testing (
17- search_method = PhononRester ().search ,
18- excluded_params = [
19- "num_chunks" ,
20- "chunk_size" ,
21- "all_fields" ,
22- "fields" ,
23- ],
24- alt_name_dict = {
25- "material_ids" : "material_id" ,
26- },
27- custom_field_tests = {
28- "material_ids" : ["mp-149" , "mp-13" ],
29- "material_ids" : "mp-149" ,
30- "phonon_method" : "dfpt" ,
31- },
32- sub_doc_fields = [],
33- )
16+ with PhononRester () as rester :
17+ client_search_testing (
18+ search_method = rester .search ,
19+ excluded_params = [
20+ "num_chunks" ,
21+ "chunk_size" ,
22+ "all_fields" ,
23+ "fields" ,
24+ ],
25+ alt_name_dict = {
26+ "material_ids" : "material_id" ,
27+ },
28+ custom_field_tests = {
29+ "material_ids" : ["mp-149" , "mp-13" ],
30+ "material_ids" : "mp-149" ,
31+ "phonon_method" : "dfpt" ,
32+ },
33+ sub_doc_fields = [],
34+ )
3435
3536
3637@requires_api_key
You can’t perform that action at this time.
0 commit comments