diff --git a/ARCtrl.sln b/ARCtrl.sln index 784d5053..c5527abb 100644 --- a/ARCtrl.sln +++ b/ARCtrl.sln @@ -67,6 +67,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Python", "Python", "{501F6D ProjectSection(SolutionItems) = preProject tests\Python\test_index.py = tests\Python\test_index.py tests\Python\test_JsonController.py = tests\Python\test_JsonController.py + tests\Python\test_OntologyAnnotation.py = tests\Python\test_OntologyAnnotation.py tests\Python\test_XlsxController.py = tests\Python\test_XlsxController.py EndProjectSection EndProject diff --git a/src/Core/ArcTypes.fs b/src/Core/ArcTypes.fs index c7923537..4f68e34d 100644 --- a/src/Core/ArcTypes.fs +++ b/src/Core/ArcTypes.fs @@ -998,6 +998,34 @@ type ArcStudy(identifier : string, ?title, ?description, ?submissionDate, ?publi /// The other ArcStudy to test for reference. member this.ReferenceEquals (other: ArcStudy) = System.Object.ReferenceEquals(this,other) + // Use this for better print debugging and better unit test output + override this.ToString() = + sprintf + """ArcStudy { + Identifier = %A, + Title = %A, + Description = %A, + SubmissionDate = %A, + PublicReleaseDate = %A, + Publications = %A, + Contacts = %A, + StudyDesignDescriptors = %A, + Tables = %A, + RegisteredAssayIdentifiers = %A, + Comments = %A, +}""" + this.Identifier + this.Title + this.Description + this.SubmissionDate + this.PublicReleaseDate + this.Publications + this.Contacts + this.StudyDesignDescriptors + this.Tables + this.RegisteredAssayIdentifiers + this.Comments + // custom check override this.Equals other = match other with @@ -1744,7 +1772,39 @@ type ArcInvestigation(identifier : string, ?title : string, ?description : strin /// If true, updating one will update the other due to mutability. /// /// The other ArcInvestigation to test for reference. - member this.ReferenceEquals (other: ArcStudy) = System.Object.ReferenceEquals(this,other) + member this.ReferenceEquals (other: ArcInvestigation) = System.Object.ReferenceEquals(this,other) + + // Use this for better print debugging and better unit test output + override this.ToString() = + sprintf + """ArcStudy { + Identifier = %A, + Title = %A, + Description = %A, + SubmissionDate = %A, + PublicReleaseDate = %A, + OntologySourceReferences = %A, + Publications = %A, + Contacts = %A, + Assays = %A, + Studies = %A, + RegisteredStudyIdentifiers = %A, + Comments = %A, + Remarks = %A, +}""" + this.Identifier + this.Title + this.Description + this.SubmissionDate + this.PublicReleaseDate + this.OntologySourceReferences + this.Publications + this.Contacts + this.Assays + this.Studies + this.RegisteredStudyIdentifiers + this.Comments + this.Remarks // custom check override this.Equals other = diff --git a/tests/Python/test_OntologyAnnotation.py b/tests/Python/test_OntologyAnnotation.py new file mode 100644 index 00000000..b0ff62c3 --- /dev/null +++ b/tests/Python/test_OntologyAnnotation.py @@ -0,0 +1,8 @@ +from .ARCtrl.arctrl import OntologyAnnotation, JsonController, ArcInvestigation + +class TestOntologyAnnotation: + + def test_create(self): + oa = OntologyAnnotation("instrument model", "MS", "MS:1234567") + assert oa.NameText == "instrument model" + \ No newline at end of file