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

def test_decimal_validation(self):

    class Person(Document, ):
        height = DecimalField(min_value=Decimal('0.1'), max_value=Decimal('3.5'))
    Person.drop_collection()
    Person(height=Decimal('1.89')).save()
    person = Person.objects.first()
    self.assertEqual(person.height, Decimal('1.89'))
    person.height = '2.0'
    person.save()
    person.height = 0.01
    self.assertRaises(ValidationError, person.validate)
    person.height = Decimal('0.01')
    self.assertRaises(ValidationError, person.validate)
    person.height = Decimal('4.0')
    self.assertRaises(ValidationError, person.validate)
    person.height = 'something    invalid'
    self.assertRaises(ValidationError, person.validate)
    person_2 = Person(height='something    invalid')
    self.assertRaises(ValidationError, person_2.validate)
