Opened 5 years ago
Closed 5 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 )
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 , 5 years ago
| Easy pickings: | set |
|---|
comment:2 by , 5 years ago
| Component: | Error reporting → Utilities |
|---|---|
| Needs tests: | set |
| Owner: | set to |
| Status: | new → assigned |
| Summary: | fix utils/baseconv.py -> self.sign → django.utils.BaseConverter doesn't respect the "sign" argument. |
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 5 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 , 5 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 , 5 years ago
| Description: | modified (diff) |
|---|---|
| Has patch: | set |
comment:6 by , 5 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.
Thanks for the report. I also agree with Simon that we should deprecate the
django.utils.baseconvmodule, but this can be done separately.