Skip to content
This repository
Browse code

remove none_p form AutoFixture class

  • Loading branch information...
commit 1eecaa58a81ddacf8c674a05e3d4f94d2536abb3 1 parent 712305e
authored October 15, 2010
10  autofixture/base.py
@@ -81,7 +81,6 @@ class Values(object):
81 81
     follow_m2m = {'ALL': (1,5)}
82 82
     generate_m2m = False
83 83
 
84  
-    none_p = 0.2
85 84
     tries = 1000
86 85
 
87 86
     field_to_generator = SortedDict((
@@ -105,7 +104,7 @@ class Values(object):
105 104
         constraints.unique_together_constraint]
106 105
 
107 106
     def __init__(self, model,
108  
-            field_values=None, none_p=None, overwrite_defaults=None,
  107
+            field_values=None, overwrite_defaults=None,
109 108
             constraints=None, follow_fk=None, generate_fk=None,
110 109
             follow_m2m=None, generate_m2m=None):
111 110
         '''
@@ -117,9 +116,6 @@ def __init__(self, model,
117 116
             a ``Generator`` instance that generates a value on the fly or a
118 117
             callable which takes no arguments and returns the wanted value.
119 118
 
120  
-            ``none_p``: The chance (between 0 and 1, 1 equals 100%) to
121  
-            assign ``None`` to nullable fields.
122  
-
123 119
             ``overwrite_defaults``: All default values of fields are preserved
124 120
             by default. If set to ``True``, default values will be treated
125 121
             like any other field.
@@ -156,8 +152,6 @@ def __init__(self, model,
156 152
         self.field_values.update(self.__class__.field_values.copy())
157 153
         self.field_values.update(field_values or {})
158 154
         self.constraints = constraints or []
159  
-        if none_p is not None:
160  
-            self.none_p = none_p
161 155
         if overwrite_defaults is not None:
162 156
             self.overwrite_defaults = overwrite_defaults
163 157
 
@@ -242,8 +236,6 @@ def get_generator(self, field):
242 236
                 return generators.CallableGenerator(value=value)
243 237
             return generators.StaticGenerator(value=value)
244 238
 
245  
-        if field.null:
246  
-            kwargs['empty_p'] = self.none_p
247 239
         if field.choices:
248 240
             return generators.ChoicesGenerator(choices=field.choices, **kwargs)
249 241
         if isinstance(field, related.ForeignKey):
3  autofixture_tests/autofixture_test/tests.py
@@ -182,7 +182,6 @@ def test_follow_only_some_m2m(self):
182 182
 
183 183
         filler = AutoFixture(
184 184
             M2MModel,
185  
-            none_p=0,
186 185
             follow_m2m={
187 186
                 'm2m': (2, 10),
188 187
             })
@@ -193,7 +192,6 @@ def test_follow_only_some_m2m(self):
193 192
     def test_generate_m2m(self):
194 193
         filler = AutoFixture(
195 194
             M2MModel,
196  
-            none_p=0,
197 195
             generate_m2m=(1, 5))
198 196
         all_m2m = set()
199 197
         all_secondm2m = set()
@@ -208,7 +206,6 @@ def test_generate_m2m(self):
208 206
     def test_generate_only_some_m2m(self):
209 207
         filler = AutoFixture(
210 208
             M2MModel,
211  
-            none_p=0,
212 209
             generate_m2m={
213 210
                 'm2m': (1, 5),
214 211
             })

0 notes on commit 1eecaa5

Please sign in to comment.
Something went wrong with that request. Please try again.