Skip to content

Invalid datemath expression can lead to NoneType #25

Closed
@kasium

Description

@kasium

Hi,

when datemath gets an invalid argument, it can happen that None is returned instead of an exception.
This is can lead to a weird NoneType if datemath.datemath is used instead of datemath.parse.

import datemath

type(datemath.parse("2")) # --> None

datemath.datemath("2")   # AttributeError: 'NoneType' object has no attribute 'datetime'

I use version 1.5.2 (latest). It would be great if both cases could raise a parse exception.

Thanks,
Kai

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions