Exemple #1
0
    def __call__(self, tokens):
        """Extracts a datetime from the METAR's timestamp.

        :param Sequence[str] tokens: the sequence of tokens being parsed.

        :return: a tuple containing the datetime (first element) and a sequence
            of the remaining tokens (second element).
        :rtype: (datetime, Sequence)
        """
        m, remainder = TimeStamp._CMD(tokens)
        report = util.guess_date(int(m["day"]), int(m["hour"]),
                                 int(m["minute"]))

        return report, remainder
Exemple #2
0
def test_guess_date(day, hour, minute, base, expected):
    actual = util.guess_date(day, hour, minute, base)
    assert actual == expected