Пример #1
0
def testOffsetTimeGenerationWithInvalidArgs(getFixtures):
    parser = DataParser()
    try:

        strTimeNow = "2016-10-09T15:48:54"
        dtOffset = parser.getOffsetTime(strTimeNow, getFixtures.offset)
        fail("should have thrown exception b/c invalid timestamp")
    except Exception as ex:
        assert (type(ex) is ValueError)
Пример #2
0
def testOffsetTimeGeneration(getFixtures):
    try:
        parser = DataParser()

        strTimeNow = "2016-10-09T15:48:54Z"
        dtOffset = parser.getOffsetTime(strTimeNow, getFixtures.offset)
        assert (dtOffset.second == 59)

        strTimeNow = "2016-10-09T15:48:55Z"
        dtOffset = parser.getOffsetTime(strTimeNow, getFixtures.offset)
        assert (dtOffset.second == 0)
        assert (dtOffset.minute == 49)

        strTimeNow = "2016-10-09T15:48:56Z"
        dtOffset = parser.getOffsetTime(strTimeNow, getFixtures.offset)
        assert (dtOffset.second == 1)
        assert (dtOffset.minute == 49)

    except Exception as ex:
        logging.debug(str(ex))
        fail("should not have an exception when parsing valid time and offset"
             )  # cause a failure