Opened 9 months ago

Closed 9 months ago

#28996 closed Cleanup/optimization (fixed)

Simplify some boolean constructs and remove some trivial 'continue' statements

Reported by: Дилян Палаузов Owned by: Priyansh Saxena
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description


Attachments (1)

bool_continue.patch (31.8 KB) - added by Дилян Палаузов 9 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 months ago by Tim Graham

Component: UncategorizedCore (Other)
Patch needs improvement: set
Summary: Play with booleans and remove some trivial 'conitnue'sSimplify some boolean constructs and remove some trivial 'continue' statements
Triage Stage: UnreviewedAccepted

The patch has a number of syntax errors and flake8 warnings. Can you please check that and ideally, also run the tests? (If you can submit the patch as a pull request, those checks would be automated.)

comment:2 Changed 9 months ago by Tim Graham

Test failure:

======================================================================
FAIL: test_render_int (forms_tests.widget_tests.test_checkboxinput.CheckboxInputTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python3.6.4/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/opt/python3.6.4/lib/python3.6/unittest/case.py", line 605, in run
    testMethod()
  File "/home/tim/code/django/tests/forms_tests/widget_tests/test_checkboxinput.py", line 40, in test_render_int
    html='<input checked type="checkbox" name="is_cool" value="0" />',
  File "/home/tim/code/django/tests/forms_tests/widget_tests/base.py", line 25, in check_html
    assertEqual(output.replace('&#34;', '&quot;'), html)
  File "/home/tim/code/django/django/test/testcases.py", line 680, in assertHTMLEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/opt/python3.6.4/lib/python3.6/unittest/case.py", line 670, in fail
    raise self.failureException(msg)
AssertionError: <input name="is_cool" type="checkbox" /> != <input checked name="is_cool" type="checkbox" value="0" />
- <input name="is_cool" type="checkbox" />
+ <input checked name="is_cool" type="checkbox" value="0" />
?       ++++++++                                ++++++++++

Changed 9 months ago by Дилян Палаузов

Attachment: bool_continue.patch added

comment:3 Changed 9 months ago by Priyansh Saxena

Owner: changed from nobody to Priyansh Saxena
Status: newassigned

comment:4 Changed 9 months ago by Tim Graham

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

PR from the patch.

comment:5 Changed 9 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In a38ae91:

Fixed #28996 -- Simplified some boolean constructs and removed trivial continue statements.

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