def to_long(value, type=None): type = type or Long() v = type.to_python_single(value) if Long.MIN_VALUE < v < Long.MAX_VALUE: return v raise ValueError('Long value must be between %s and %s' % (Long.MIN_VALUE, Long.MAX_VALUE))
def test_from_python__is_none(self): # self.assertIsNone(String().from_python(None)) self.assertIsNone(Byte().from_python(None)) self.assertIsNone(Short().from_python(None)) self.assertIsNone(Integer().from_python(None)) self.assertIsNone(Long().from_python(None)) self.assertIsNone(Float().from_python(None)) self.assertIsNone(Double().from_python(None)) # self.assertIsNone(Date().from_python(None)) # self.assertIsNone(Boolean().from_python(None)) # self.assertIsNone(Binary().from_python(None)) self.assertIsNone(Ip().from_python(None)) self.assertIsNone(Object(DynamicDocument).from_python(None)) # self.assertIsNone(Nested().to_python(None)) # self.assertIsNone(List(String).from_python(None)) self.assertIsNone(GeoPoint().from_python(None)) self.assertIsNone(Completion().from_python(None))