Skip to content

"parse()" for ambiguous number does not raise exception with Pendlum pure Python implemention #394

Open

Description

@Delgan

See #251.

# Pendulum built with "PENDULUM_EXTENSIONS=0"
>>> pendulum.parse("13")
DateTime(2019, 8, 8, 13, 0, 0, tzinfo=Timezone('UTC'))
# Pendulum built with "PENDULUM_EXTENSIONS=1"
>>> pendulum.parse("13")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/delgan/env/lib/python3.7/site-packages/pendulum/parser.py", line 20, in parse
    return _parse(text, **options)
  File "/home/delgan/env/lib/python3.7/site-packages/pendulum/parser.py", line 36, in _parse
    parsed = base_parse(text, **options)
  File "/home/delgan/env/lib/python3.7/site-packages/pendulum/parsing/__init__.py", line 70, in parse
    return _normalize(_parse(text, **_options), **_options)
  File "/home/delgan/env/lib/python3.7/site-packages/pendulum/parsing/__init__.py", line 124, in _parse
    raise ParserError("Unable to parse string [{}]".format(text))
pendulum.parsing.exceptions.ParserError: Unable to parse string [13]

The Python implementation should fail too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions