Opened 4 years ago

Closed 4 years ago

#32709 closed Bug (fixed)

Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.

Reported by: pythonwood Owned by: pythonwood
Component: Utilities Version: 3.2
Severity: Normal Keywords: utils
Cc: wuweishun@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by pythonwood)


NOW:
In fact, I found the right way is patch doc string instead of code.

I have a simple right (new) pull in gihub 14344 https://github.com/django/django/pull/14344


BEFORE:

I have a simple pull in gihub # 14339
https://github.com/django/django/pull/14339/commits/86e0ec9df0b5ed7a9160c10974bf1adef19eb539

def encode(self, i):
      neg, value = self.convert(i, self.decimal_digits, self.digits, '-')

try and know that arg '-' should be self.sign:

In [1]: from django.utils import baseconv

In [2]: base11 = baseconv.BaseConverter('0123456789-', sign='$')

In [3]: base11.encode('$1234')

ValueError: substring not found

Change History (7)

comment:1 by pythonwood, 4 years ago

Easy pickings: set

comment:2 by Mariusz Felisiak, 4 years ago

Component: Error reportingUtilities
Needs tests: set
Owner: set to pythonwood
Status: newassigned
Summary: fix utils/baseconv.py -> self.signdjango.utils.BaseConverter doesn't respect the "sign" argument.
Triage Stage: UnreviewedAccepted

Thanks for the report. I also agree with Simon that we should deprecate the django.utils.baseconv module, but this can be done separately, see #32712.

Last edited 4 years ago by Mariusz Felisiak (previous) (diff)

comment:3 by Mariusz Felisiak, 4 years ago

Summary: django.utils.BaseConverter doesn't respect the "sign" argument.django.utils.baseconv.BaseConverter doesn't respect the "sign" argument.

comment:4 by Mariusz Felisiak, 4 years ago

Has patch: unset
Needs tests: unset
Summary: django.utils.baseconv.BaseConverter doesn't respect the "sign" argument.Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.

comment:5 by pythonwood, 4 years ago

Description: modified (diff)
Has patch: set
Last edited 4 years ago by Mariusz Felisiak (previous) (diff)

comment:6 by pythonwood, 4 years ago

in fact, after look into regression test tests/utils_tests/test_baseconv.py, I fount that It is wrong doc string instead of code.

comment:7 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 071cf686:

Fixed #32709 -- Corrected examples in django/utils/baseconv.py docstring.

Note: See TracTickets for help on using tickets.
Back to Top