'Test dynamic helper for returning the display value of a choices
field.'

def test_simple_choices_get_field_display(self):

    class Shirt(Document, ):
        size = StringField(max_length=3, choices=('S', 'M', 'L', 'XL', 'XXL'))
        style = StringField(max_length=3, choices=('Small', 'Baggy', 'wide'), default='Small')
    Shirt.drop_collection()
    shirt = Shirt()
    self.assertEqual(shirt.get_size_display(), None)
    self.assertEqual(shirt.get_style_display(), 'Small')
    shirt.size = 'XXL'
    shirt.style = 'Baggy'
    self.assertEqual(shirt.get_size_display(), 'XXL')
    self.assertEqual(shirt.get_style_display(), 'Baggy')
    shirt.size = 'Z'
    shirt.style = 'Z'
    self.assertEqual(shirt.get_size_display(), 'Z')
    self.assertEqual(shirt.get_style_display(), 'Z')
    self.assertRaises(ValidationError, shirt.validate)
