Пример #1
0
    def test_positiveIntegerOrZero(self):

        props = (
            (
                "SUMMARY:Test",
                False,
            ),
            (
                "REPEAT:0",
                True,
            ),
            (
                "REPEAT:100",
                True,
            ),
            (
                "REPEAT:-1",
                False,
            ),
        )

        for prop, result in props:
            property = Property.parseText(prop)
            self.assertEqual(
                PropertyValueChecks.positiveIntegerOrZero(property), result)
Пример #2
0
    def test_stringValue(self):

        props = (
            ("SUMMARY:Test", "Test", True,),
            ("SUMMARY:Test", "TEST", True,),
            ("DTSTART:20110623T174806", "Test", False),
        )

        for prop, test, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.stringValue(test, property), result)
Пример #3
0
    def test_positiveIntegerOrZero(self):

        props = (
            ("SUMMARY:Test", False,),
            ("REPEAT:0", True,),
            ("REPEAT:100", True,),
            ("REPEAT:-1", False,),
        )

        for prop, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.positiveIntegerOrZero(property), result)
Пример #4
0
    def test_alwaysUTC(self):

        props = (
            ("SUMMARY:Test", False,),
            ("DTSTART:20110623T174806", False),
            ("DTSTART;VALUE=DATE:20110623", False),
            ("DTSTART:20110623T174806Z", True),
        )

        for prop, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.alwaysUTC(property), result)
Пример #5
0
    def test_numericRange(self):

        props = (
            ("SUMMARY:Test", 0, 100, False,),
            ("PERCENT-COMPLETE:0", 0, 100, True,),
            ("PERCENT-COMPLETE:100", 0, 100, True,),
            ("PERCENT-COMPLETE:50", 0, 100, True,),
            ("PERCENT-COMPLETE:200", 0, 100, False,),
            ("PERCENT-COMPLETE:-1", 0, 100, False,),
        )

        for prop, low, high, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.numericRange(low, high, property), result)
Пример #6
0
    def test_alwaysUTC(self):

        props = (
            (
                "SUMMARY:Test",
                False,
            ),
            ("DTSTART:20110623T174806", False),
            ("DTSTART;VALUE=DATE:20110623", False),
            ("DTSTART:20110623T174806Z", True),
        )

        for prop, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.alwaysUTC(property), result)
Пример #7
0
    def test_numericRange(self):

        props = (
            (
                "SUMMARY:Test",
                0,
                100,
                False,
            ),
            (
                "PERCENT-COMPLETE:0",
                0,
                100,
                True,
            ),
            (
                "PERCENT-COMPLETE:100",
                0,
                100,
                True,
            ),
            (
                "PERCENT-COMPLETE:50",
                0,
                100,
                True,
            ),
            (
                "PERCENT-COMPLETE:200",
                0,
                100,
                False,
            ),
            (
                "PERCENT-COMPLETE:-1",
                0,
                100,
                False,
            ),
        )

        for prop, low, high, result in props:
            property = Property.parseText(prop)
            self.assertEqual(
                PropertyValueChecks.numericRange(low, high, property), result)
Пример #8
0
    def test_stringValue(self):

        props = (
            (
                "SUMMARY:Test",
                "Test",
                True,
            ),
            (
                "SUMMARY:Test",
                "TEST",
                True,
            ),
            ("DTSTART:20110623T174806", "Test", False),
        )

        for prop, test, result in props:
            property = Property.parseText(prop)
            self.assertEqual(PropertyValueChecks.stringValue(test, property),
                             result)