Skip to content

convert_date returns 'str' object instead of None for illegal values #993

@p3dda

Description

@p3dda

Describe the bug

According to docstrings for the convert_date method, illegal values should be returned as None. In fact, the method returns the original date value as string

To Reproduce

Code:

import pymysql.converters

pymysql.converters.convert_date('2007-02-31')
pymysql.converters.convert_date('0000-00-00')

Returned values are '2007-02-31' and '0000-00-00'

Expected behavior

According to the docstring, expected return values would be None:

      >>> convert_date('2007-02-31') is None
      True
      >>> convert_date('0000-00-00') is None
      True

Environment

  • OS: Linux
  • PyMySQL version: 1.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions