Opened 7 years ago

Closed 7 years 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: dev
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 Дилян Палаузов 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Tim Graham, 7 years ago

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 by Tim Graham, 7 years ago

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" />
?       ++++++++                                ++++++++++

by Дилян Палаузов, 7 years ago

Attachment: bool_continue.patch added

comment:3 by Priyansh Saxena, 7 years ago

Owner: changed from nobody to Priyansh Saxena
Status: newassigned

comment:4 by Tim Graham, 7 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

PR from the patch.

comment:5 by Tim Graham <timograham@…>, 7 years ago

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