'Ensure that invalid values cannot be assigned to float fields.'

def test_float_validation(self):

    class Person(Document, ):
        height = FloatField(min_value=0.1, max_value=3.5)
    class BigPerson(Document, ):
        height = FloatField()
    person = Person()
    person.height = 1.89
    person.validate()
    person.height = '2.0'
    self.assertRaises(ValidationError, person.validate)
    person.height = 0.01
    self.assertRaises(ValidationError, person.validate)
    person.height = 4.0
    self.assertRaises(ValidationError, person.validate)
    person_2 = Person(height='something    invalid')
    self.assertRaises(ValidationError, person_2.validate)
    big_person = BigPerson()
    for (value, value_type) in enumerate(six.integer_types):
        big_person.height = value_type(value)
        big_person.validate()
    big_person.height = (2 ** 500)
    big_person.validate()
    big_person.height = (2 ** 100000)
    self.assertRaises(ValidationError, big_person.validate)
