'Check that different ways of reading the value
from the model class give the same expected result'

def _check_value_is_correct_in_db(self, value):

    if (value is None):
        result = self.model_class.objects.all().allow_filtering().filter(test_id=0).first()
        self.assertIsNone(result.class_param)
        result = self.model_class.objects(test_id=0).first()
        self.assertIsNone(result.class_param)
    else:
        if (not isinstance(value, self.python_klass)):
            value_to_compare = self.python_klass(value)
        else:
            value_to_compare = value
        result = self.model_class.objects(test_id=0).first()
        self.assertIsInstance(result.class_param, self.python_klass)
        self.assertEqual(result.class_param, value_to_compare)
        result = self.model_class.objects.all().allow_filtering().filter(test_id=0).first()
        self.assertIsInstance(result.class_param, self.python_klass)
        self.assertEqual(result.class_param, value_to_compare)
        result = self.model_class.objects.all().allow_filtering().filter(test_id=0, class_param=value).first()
        self.assertIsInstance(result.class_param, self.python_klass)
        self.assertEqual(result.class_param, value_to_compare)
    return result
