1818 DownloadDataFile ,
1919 DownloadDataset ,
2020 DownloadOrigDatablock ,
21+ Technique ,
2122 UploadDerivedDataset ,
2223 UploadRawDataset ,
2324)
@@ -430,12 +431,12 @@ def test_orcid_validation_valid(good_orcid: str) -> None:
430431 dset = Dataset (
431432 type = "raw" ,
432433 name = "test ORCID" ,
433- contact_email = "jan-lukas.wynen@ess.eu " ,
434+ contact_email = "mail.person@sci.uni " ,
434435 creation_location = "scitacean/tests" ,
435436 creation_time = "2142-04-02T16:44:56" ,
436- owner = "Jan-Lukas Wynen " ,
437+ owner = "Mustrum Ridcully " ,
437438 owner_group = "ess" ,
438- principal_investigator = "jan-lukas.wynen@ess.eu " ,
439+ principal_investigator = "mail.person@sci.uni " ,
439440 source_folder = RemotePath ("/hex/source62" ),
440441 orcid_of_owner = good_orcid ,
441442 )
@@ -454,16 +455,64 @@ def test_orcid_validation_valid(good_orcid: str) -> None:
454455def test_orcid_validation_missing_url (bad_orcid : str ) -> None :
455456 dset = Dataset (
456457 type = "raw" ,
457- contact_email = "jan-lukas.wynen@ess.eu " ,
458+ contact_email = "mail.person@sci.uni " ,
458459 creation_time = "2142-04-02T16:44:56" ,
459- owner = "Jan-Lukas Wynen " ,
460+ owner = "Mustrum Ridcully " ,
460461 owner_group = "ess" ,
461- principal_investigator = "jan-lukas.wynen@ess.eu " ,
462+ principal_investigator = "mail.person@sci.uni " ,
462463 source_folder = RemotePath ("/hex/source62" ),
463464 orcid_of_owner = bad_orcid ,
464465 )
465466 with pytest .raises (pydantic .ValidationError ):
466467 dset .make_upload_model ()
467468
468469
469- # TODO technique
470+ def test_technique_set_model () -> None :
471+ technique = Technique (pid = "test/technique" , name = "Test Technique" )
472+ dset = Dataset (
473+ type = "raw" ,
474+ contact_email = "mail.person@sci.uni" ,
475+ creation_time = "2142-04-02T16:44:56" ,
476+ owner = "Mustrum Ridcully" ,
477+ owner_group = "ess" ,
478+ principal_investigator = "mail.person@sci.uni" ,
479+ source_folder = RemotePath ("/hex/source62" ),
480+ techniques = [technique ],
481+ )
482+ assert dset .techniques == [technique ]
483+
484+
485+ def test_technique_set_label () -> None :
486+ dset = Dataset (
487+ type = "raw" ,
488+ contact_email = "mail.person@sci.uni" ,
489+ creation_time = "2142-04-02T16:44:56" ,
490+ owner = "Mustrum Ridcully" ,
491+ owner_group = "ess" ,
492+ principal_investigator = "mail.person@sci.uni" ,
493+ source_folder = RemotePath ("/hex/source62" ),
494+ techniques = ["neutron powder diffraction" ],
495+ )
496+ expected = Technique (
497+ pid = "http://purl.org/pan-science/PaNET/PaNET01100" ,
498+ name = "neutron powder diffraction" ,
499+ )
500+ Technique (
501+ name = "neutron powder diffraction" ,
502+ pid = "http://purl.org/pan-science/PaNET/PaNET01100" ,
503+ )
504+ assert dset .techniques == [expected ]
505+
506+
507+ def test_technique_set_invalid_label_raises_value_error () -> None :
508+ dset = Dataset (
509+ type = "raw" ,
510+ contact_email = "mail.person@sci.uni" ,
511+ creation_time = "2142-04-02T16:44:56" ,
512+ owner = "Mustrum Ridcully" ,
513+ owner_group = "ess" ,
514+ principal_investigator = "mail.person@sci.uni" ,
515+ source_folder = RemotePath ("/hex/source62" ),
516+ )
517+ with pytest .raises (ValueError , match = "Unknown technique" ):
518+ dset .techniques = ["bad technique" ]
0 commit comments