Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove none_p form AutoFixture class

  • Loading branch information...
commit 1eecaa58a81ddacf8c674a05e3d4f94d2536abb3 1 parent 712305e
Mikko Hellsing authored
View
10 autofixture/base.py
@@ -81,7 +81,6 @@ class Values(object):
follow_m2m = {'ALL': (1,5)}
generate_m2m = False
- none_p = 0.2
tries = 1000
field_to_generator = SortedDict((
@@ -105,7 +104,7 @@ class Values(object):
constraints.unique_together_constraint]
def __init__(self, model,
- field_values=None, none_p=None, overwrite_defaults=None,
+ field_values=None, overwrite_defaults=None,
constraints=None, follow_fk=None, generate_fk=None,
follow_m2m=None, generate_m2m=None):
'''
@@ -117,9 +116,6 @@ def __init__(self, model,
a ``Generator`` instance that generates a value on the fly or a
callable which takes no arguments and returns the wanted value.
- ``none_p``: The chance (between 0 and 1, 1 equals 100%) to
- assign ``None`` to nullable fields.
-
``overwrite_defaults``: All default values of fields are preserved
by default. If set to ``True``, default values will be treated
like any other field.
@@ -156,8 +152,6 @@ def __init__(self, model,
self.field_values.update(self.__class__.field_values.copy())
self.field_values.update(field_values or {})
self.constraints = constraints or []
- if none_p is not None:
- self.none_p = none_p
if overwrite_defaults is not None:
self.overwrite_defaults = overwrite_defaults
@@ -242,8 +236,6 @@ def get_generator(self, field):
return generators.CallableGenerator(value=value)
return generators.StaticGenerator(value=value)
- if field.null:
- kwargs['empty_p'] = self.none_p
if field.choices:
return generators.ChoicesGenerator(choices=field.choices, **kwargs)
if isinstance(field, related.ForeignKey):
View
3  autofixture_tests/autofixture_test/tests.py
@@ -182,7 +182,6 @@ def test_follow_only_some_m2m(self):
filler = AutoFixture(
M2MModel,
- none_p=0,
follow_m2m={
'm2m': (2, 10),
})
@@ -193,7 +192,6 @@ def test_follow_only_some_m2m(self):
def test_generate_m2m(self):
filler = AutoFixture(
M2MModel,
- none_p=0,
generate_m2m=(1, 5))
all_m2m = set()
all_secondm2m = set()
@@ -208,7 +206,6 @@ def test_generate_m2m(self):
def test_generate_only_some_m2m(self):
filler = AutoFixture(
M2MModel,
- none_p=0,
generate_m2m={
'm2m': (1, 5),
})
Please sign in to comment.
Something went wrong with that request. Please try again.