示例#1
0
    def testInvalidOntologyInput15(self):
        """
        This is an invali input, as the Duo Term number is missing
        """
        sample = {"duo": [{"id": "DUO:"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#2
0
    def testInvalidOntologyInput2(self):
        """
        This is an invalid input, as 'Duo' key should be lower case.
        """
        sample = {"Duo": [{"id": "DUO:0000018"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#3
0
    def testInvalidOntologyInput14(self):
        """
        This is an invalid input, as there the list of Duo Terms is empty
        """
        sample = {"duo": []}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#4
0
    def testInvalidOntologyInput6(self):
        """
        This is an invalid input, as there is no 'modifier' for DUO:0000024
        """
        sample = {"duo": [{"id": "DUO:0000024"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#5
0
    def testInvalidOntologyInput10(self):
        """
        This is an invalid input, as the DUO term in totally invalid
        """
        sample = {"duo": [{"id": "DUO:0000089"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#6
0
    def testInvalidOntologyInput1(self):
        """
        This is an invalid input, as id DUO:0000002 is not supported.
        """
        sample = {"duo": [{"id": "DUO:0000002"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#7
0
    def testInvalidOntologyInput5(self):
        """
        This is an invalid input, as there is no DUO Term under 'id'
        """
        sample = {"duo": [{"id": ""}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#8
0
    def testInvalidOntologyInput16(self):
        """
        This is an invalid input, as 'modifier' is supplied with 
        Duo Term that does not require it
        """
        sample = {"duo": [{"id": "DUO:0000018", "modifier": "2022-01-01"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#9
0
    def testInvalidOntologyInput13(self):
        """
        This in an invalid input, as there is only the integer part of the
        Duo Term under 'id'
        """
        sample = {"duo": [{"id": "18"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#10
0
    def testInvalidOntologyInput11(self):
        """
        This in an invalid input, as the DUO word in 
        'id: DUO:0000018' is not uppercase
        """
        sample = {"duo": [{"id": "DUo:0000018"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#11
0
    def testInvalidOntologyInput9(self):
        """
        This is an invalid input, as 'Modifier' key word 
        should be lower case
        """
        sample = {"duo": [{"id": "DUO:0000024", "Modifier": "2022-01-01"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#12
0
    def testInvalidOntologyInput8(self):
        """
        This is an invalid input, as 'DUO:0000024' modifier has an 
        invalid date
        """
        sample = {"duo": [{"id": "DUO:0000024", "modifier": "2022-20-20"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#13
0
    def testInvalidOntologyInput7(self):
        """
        This is an invalid input, as date for 'DUO:0000024' does not follow 
        format YYYY-MM-DD
        """
        sample = {"duo": [{"id": "DUO:0000024", "modifier": "01-01-2022"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#14
0
    def testInvalidOntologyInput12(self):
        """
        This is an invalid imput, as the DUO Term does not follow 
        correct format
        """
        sample = {"duo": [{"id": "DUO:0018"}]}

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#15
0
    def testInvalidOntologyInput4(self):
        """
        This is an invalid input, as 'id' key is missing
        """
        sample = {
            "duo": [{
                "": "DUO:0000018"
            }, {
                "id": "DUO:0000024",
                "modifier": "2022-01-01"
            }]
        }

        parser = OntologyValidator(sample)

        self.assertFalse(parser.validate_duo())
示例#16
0
    def testValidOntologyInput1(self):
        """
        This is a valid input, as a correctly-formatted date is provided 
        for DUO:0000024
        """
        sample = {
            "duo": [{
                "id": "DUO:0000018"
            }, {
                "id": "DUO:0000024",
                "modifier": "2022-01-01"
            }]
        }

        parser = OntologyValidator(sample)

        self.assertTrue(parser.validate_duo())
示例#17
0
    def testValidOntologyInput2(self):
        """
        This unit test loops through every valid Duo Term except 
        'DUO:0000024', which is covered in testValidOntologyInput1
        """
        listOfValidDuoIds = [
            "DUO:0000001", "DUO:0000004", "DUO:0000005", "DUO:0000006",
            "DUO:0000007", "DUO:0000011", "DUO:0000012", "DUO:0000014",
            "DUO:0000015", "DUO:0000016", "DUO:0000017", "DUO:0000018",
            "DUO:0000019", "DUO:0000020", "DUO:0000021", "DUO:0000026",
            "DUO:0000027", "DUO:0000028", "DUO:0000029", "DUO:0000042"
        ]

        for term in listOfValidDuoIds:

            sample = {"duo": [{"id": term}]}

            parser = OntologyValidator(sample)

            self.assertTrue(parser.validate_duo())