jenisys / parse_type

parse_type extends the parse module (opposite of string.format())

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tests fail

brianmay opened this issue · comments

=================================== FAILURES ===================================
________________________ TestParse.test_too_many_fields ________________________

self = <tests.test_parse_type_parse.TestParse testMethod=test_too_many_fields>

    def test_too_many_fields(self):
        p = parse.compile('{:ti}' * 15)
>       self.assertRaises(parse.TooManyFields, p.parse, '')
E       AssertionError: TooManyFields not raised by parse

tests/test_parse_type_parse.py:610: AssertionError
===================== 1 failed, 180 passed in 0.31 seconds =====================

This is with version 0.3.4

Seems that the function returns a None value rather then raising TooManyFields. I have no idea if the test is broken or the function is broken.

From a comment in the code:

Note: attempting to match too many datetime fields in a single parse() will
currently result in a resource allocation issue. A TooManyFields exception
will be raised in this instance. The current limit is about 15. It is hoped
that this limit will be removed one day.

So it would seem this was a limitation, and that limitation no longer exists. So presumably the test should be dropped.

Test code changed (and was never failing for me on two platforms).