Changes between Initial Version and Version 5 of Ticket #23128


Ignore:
Timestamp:
May 7, 2016, 5:03:05 PM (8 years ago)
Author:
Tim Graham
Comment:

I don't think there's an issue here. The Counter used for the choices in WhizIter generates values starting from two, not one so the provided test isn't correct. If you change the first line to self.assertEqual(WhizIter(c=2).get_c_display(), 'val-2') it passes.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23128

    • Property Triage Stage UnreviewedAccepted
    • Property Cc cmawebsite@… added
    • Property Owner changed from nobody to Sergii Lapin
    • Property Status newclosed
    • Property Resolutionworksforme
  • Ticket #23128 – Description

    initial v5  
    1414
    1515Edit `tests/model_fields/tests.py` add inside `class ChoicesTests(test.TestCase)` the following tests:
    16 
    17     # def test_iterator_choices_and_field_display(self):
    18     #     """
    19     #     Check that get_choices works with Iterators (#23112).
    20     #     """
    21     #     self.assertEqual(WhizIter(c=1).get_c_display(), 'val-1')    # A nested value
    22     #     self.assertEqual(WhizIter(c=9).get_c_display(), 9)          # Invalid value
    23     #     self.assertEqual(WhizIter(c=None).get_c_display(), None)    # Blank value
    24     #     self.assertEqual(WhizIter(c='').get_c_display(), '')        # Empty value
     16{{{
     17def test_iterator_choices_and_field_display(self):
     18    """
     19    Check that get_choices works with Iterators (#23112).
     20    """
     21    self.assertEqual(WhizIter(c=1).get_c_display(), 'val-1') # A nested value
     22    self.assertEqual(WhizIter(c=9).get_c_display(), 9) # Invalid value
     23    self.assertEqual(WhizIter(c=None).get_c_display(), None) # Blank value
     24    self.assertEqual(WhizIter(c='').get_c_display(), '') # Empty value
     25}}}
Back to Top