Skip to content

Commit

Permalink
Merge pull request doableware#392 from nesdis/improved_testing
Browse files Browse the repository at this point in the history
Improved testing
  • Loading branch information
nesdis authored Apr 15, 2020
2 parents d871381 + db2658d commit ccf0487
Show file tree
Hide file tree
Showing 52 changed files with 1,175 additions and 895 deletions.
1 change: 0 additions & 1 deletion djongo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This version of Djongo was made possible by
# the generous contributions from:
#
# * TechDragon
# * Zachary Sizemore
# * Wayne Van Son
# * Norman Niemer
Expand Down
35 changes: 18 additions & 17 deletions djongo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,36 @@ class DatabaseWrapper(BaseDatabaseWrapper):
# This dictionary will map Django model field types to appropriate data
# types to be used in the database.
data_types = {
'AutoField': 'int32',
'BigAutoField': 'int64',
'BinaryField': 'binary',
'BooleanField': 'boolean',
'AutoField': 'int',
'BigAutoField': 'long',
'BinaryField': 'binData',
'BooleanField': 'bool',
'CharField': 'string',
'CommaSeparatedIntegerField': 'string',
'DateField': 'date',
'DateTimeField': 'date',
'DecimalField': 'number',
'DurationField': 'int64',
'DecimalField': 'decimal',
'DurationField': 'long',
'FileField': 'string',
'FilePathField': 'string',
'FloatField': 'number',
'IntegerField': 'int32',
'BigIntegerField': 'int64',
'FloatField': 'double',
'IntegerField': 'int',
'BigIntegerField': 'long',
'IPAddressField': 'string',
'GenericIPAddressField': 'string',
'NullBooleanField': 'boolean',
'OneToOneField': 'int32',
'PositiveIntegerField': 'int64',
'PositiveSmallIntegerField': 'int32',
'NullBooleanField': 'bool',
'OneToOneField': 'int',
'PositiveIntegerField': 'long',
'PositiveSmallIntegerField': 'int',
'SlugField': 'string',
'SmallIntegerField': 'int32',
'SmallIntegerField': 'int',
'TextField': 'string',
'TimeField': 'date',
'UUIDField': 'string',
'ObjectIdField': 'oid',
'ListField': 'array',
'DictField': 'object'
'GenericObjectIdField': 'objectId',
'ObjectIdField': 'objectId',
'EmbeddedField': 'object',
'ArrayField': 'array'
}

data_types_suffix = {
Expand Down
28 changes: 28 additions & 0 deletions djongo/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
djongo_access_url = 'https://www.patreon.com/nesdis'
_printed_features = set()


class SQLDecodeError(ValueError):

def __init__(self, err_sql=None):
self.err_sql = err_sql


class NotSupportedError(ValueError):

def __init__(self, keyword=None):
self.keyword = keyword


class MigrationError(Exception):

def __init__(self, field):
self.field = field


def print_warn(feature=None, message=None):
if feature not in _printed_features:
message = ((message or f'This version of djongo does not support "{feature}" fully. ')
+ f'Visit {djongo_access_url}')
print(message)
_printed_features.add(feature)
8 changes: 4 additions & 4 deletions djongo/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from django.db.models import *

from .fields import (
ArrayField, ListField, DjongoManager,
ArrayField, DjongoManager,
EmbeddedField, ArrayReferenceField, ObjectIdField,
GenericObjectIdField, DictField
GenericObjectIdField
)

__all__ = django_models + [
'DjongoManager', 'ListField', 'ArrayField',
'DjongoManager', 'ArrayField',
'EmbeddedField', 'ArrayReferenceField', 'ObjectIdField',
'GenericObjectIdField', 'DictField'
'GenericObjectIdField'
]
Loading

0 comments on commit ccf0487

Please sign in to comment.