def test_min_val_max_val_args(self): """Ensure that the ``min_val`` and ``max_val`` args are respected.""" min_val = randint(-1000, 0) max_val = randint(0, 1000) # First, we'll allow a range of values… val = entity_fields.IntegerField(min_val, max_val).gen_value() self.assertGreaterEqual(val, min_val) self.assertLessEqual(val, max_val) # … then, we'll allow only a single value… val = entity_fields.IntegerField(min_val, min_val).gen_value() self.assertEqual(val, min_val) # … twice over, just to be sure. val = entity_fields.IntegerField(max_val, max_val).gen_value() self.assertEqual(val, max_val)
def test_max_val_arg(self): """Ensure that the ``max_val`` argument is respected.""" max_val = randint(-1000, 1000) val = entity_fields.IntegerField(max_val=max_val).gen_value() self.assertLessEqual(val, max_val)
def test_int_is_returned(self): """Enture the value returned is an ``int``.""" self.assertIsInstance(entity_fields.IntegerField().gen_value(), int)