Generate a list of dicts with random values. Each dict has the form `{'u': int value, 'v': float value, 'w': bool value}`
(self, n, none_prob=DEFAULT_NONE_PROB)
| 256 | return tuples |
| 257 | |
| 258 | def generate_dict_list(self, n, none_prob=DEFAULT_NONE_PROB): |
| 259 | """ |
| 260 | Generate a list of dicts with random values. |
| 261 | Each dict has the form |
| 262 | |
| 263 | `{'u': int value, 'v': float value, 'w': bool value}` |
| 264 | """ |
| 265 | ints = self.generate_int_list(n, none_prob=none_prob) |
| 266 | floats = self.generate_float_list(n, none_prob=none_prob) |
| 267 | bools = self.generate_bool_list(n, none_prob=none_prob) |
| 268 | dicts = [] |
| 269 | # Keep half the Nones, omit the other half |
| 270 | keep_nones = itertools.cycle([True, False]) |
| 271 | for u, v, w in zip(ints, floats, bools): |
| 272 | d = {} |
| 273 | if u is not None or next(keep_nones): |
| 274 | d['u'] = u |
| 275 | if v is not None or next(keep_nones): |
| 276 | d['v'] = v |
| 277 | if w is not None or next(keep_nones): |
| 278 | d['w'] = w |
| 279 | dicts.append(d) |
| 280 | self.sprinkle_nones(dicts, none_prob) |
| 281 | assert len(dicts) == n |
| 282 | return dicts |
| 283 | |
| 284 | def get_type_and_builtins(self, n, type_name): |
| 285 | """ |
no test coverage detected