Skip to content

Commit 98c5228

Browse files
committed
Add ToString overrides for study/investigation
1 parent 9ebd796 commit 98c5228

3 files changed

Lines changed: 70 additions & 1 deletion

File tree

ARCtrl.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Python", "Python", "{501F6D
6767
ProjectSection(SolutionItems) = preProject
6868
tests\Python\test_index.py = tests\Python\test_index.py
6969
tests\Python\test_JsonController.py = tests\Python\test_JsonController.py
70+
tests\Python\test_OntologyAnnotation.py = tests\Python\test_OntologyAnnotation.py
7071
tests\Python\test_XlsxController.py = tests\Python\test_XlsxController.py
7172
EndProjectSection
7273
EndProject

src/Core/ArcTypes.fs

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,34 @@ type ArcStudy(identifier : string, ?title, ?description, ?submissionDate, ?publi
998998
/// <param name="other">The other ArcStudy to test for reference.</param>
999999
member this.ReferenceEquals (other: ArcStudy) = System.Object.ReferenceEquals(this,other)
10001000

1001+
// Use this for better print debugging and better unit test output
1002+
override this.ToString() =
1003+
sprintf
1004+
"""ArcStudy {
1005+
Identifier = %A,
1006+
Title = %A,
1007+
Description = %A,
1008+
SubmissionDate = %A,
1009+
PublicReleaseDate = %A,
1010+
Publications = %A,
1011+
Contacts = %A,
1012+
StudyDesignDescriptors = %A,
1013+
Tables = %A,
1014+
RegisteredAssayIdentifiers = %A,
1015+
Comments = %A,
1016+
}"""
1017+
this.Identifier
1018+
this.Title
1019+
this.Description
1020+
this.SubmissionDate
1021+
this.PublicReleaseDate
1022+
this.Publications
1023+
this.Contacts
1024+
this.StudyDesignDescriptors
1025+
this.Tables
1026+
this.RegisteredAssayIdentifiers
1027+
this.Comments
1028+
10011029
// custom check
10021030
override this.Equals other =
10031031
match other with
@@ -1744,7 +1772,39 @@ type ArcInvestigation(identifier : string, ?title : string, ?description : strin
17441772
/// If true, updating one will update the other due to mutability.
17451773
/// </summary>
17461774
/// <param name="other">The other ArcInvestigation to test for reference.</param>
1747-
member this.ReferenceEquals (other: ArcStudy) = System.Object.ReferenceEquals(this,other)
1775+
member this.ReferenceEquals (other: ArcInvestigation) = System.Object.ReferenceEquals(this,other)
1776+
1777+
// Use this for better print debugging and better unit test output
1778+
override this.ToString() =
1779+
sprintf
1780+
"""ArcStudy {
1781+
Identifier = %A,
1782+
Title = %A,
1783+
Description = %A,
1784+
SubmissionDate = %A,
1785+
PublicReleaseDate = %A,
1786+
OntologySourceReferences = %A,
1787+
Publications = %A,
1788+
Contacts = %A,
1789+
Assays = %A,
1790+
Studies = %A,
1791+
RegisteredStudyIdentifiers = %A,
1792+
Comments = %A,
1793+
Remarks = %A,
1794+
}"""
1795+
this.Identifier
1796+
this.Title
1797+
this.Description
1798+
this.SubmissionDate
1799+
this.PublicReleaseDate
1800+
this.OntologySourceReferences
1801+
this.Publications
1802+
this.Contacts
1803+
this.Assays
1804+
this.Studies
1805+
this.RegisteredStudyIdentifiers
1806+
this.Comments
1807+
this.Remarks
17481808

17491809
// custom check
17501810
override this.Equals other =
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from .ARCtrl.arctrl import OntologyAnnotation, JsonController, ArcInvestigation
2+
3+
class TestOntologyAnnotation:
4+
5+
def test_create(self):
6+
oa = OntologyAnnotation("instrument model", "MS", "MS:1234567")
7+
assert oa.NameText == "instrument model"
8+

0 commit comments

Comments
 (0)