Commit f20cb343e16aa1013591421a9bff7a12ce883250
1 parent
4a2c6e56
change generation of feature.enum.title
Showing
2 changed files
with
8 additions
and
6 deletions
@@ -304,7 +304,8 @@ def test_tender_data_limited(params): | @@ -304,7 +304,8 @@ def test_tender_data_limited(params): | ||
304 | 304 | ||
305 | 305 | ||
306 | def test_feature_data(): | 306 | def test_feature_data(): |
307 | - return munchify({ | 307 | + words = fake.words() |
308 | + feature = { | ||
308 | "code": uuid4().hex, | 309 | "code": uuid4().hex, |
309 | "title": field_with_id("f", fake.title()), | 310 | "title": field_with_id("f", fake.title()), |
310 | "title_en": field_with_id('f', fake_en.sentence(nb_words=5, variable_nb_words=True)), | 311 | "title_en": field_with_id('f', fake_en.sentence(nb_words=5, variable_nb_words=True)), |
@@ -313,18 +314,19 @@ def test_feature_data(): | @@ -313,18 +314,19 @@ def test_feature_data(): | ||
313 | "enum": [ | 314 | "enum": [ |
314 | { | 315 | { |
315 | "value": 0.05, | 316 | "value": 0.05, |
316 | - "title": fake.word() | 317 | + "title": words[0] |
317 | }, | 318 | }, |
318 | { | 319 | { |
319 | "value": 0.01, | 320 | "value": 0.01, |
320 | - "title": fake.word() | 321 | + "title": words[1] |
321 | }, | 322 | }, |
322 | { | 323 | { |
323 | "value": 0, | 324 | "value": 0, |
324 | - "title": fake.word() | 325 | + "title": words[2] |
325 | } | 326 | } |
326 | ] | 327 | ] |
327 | - }) | 328 | + } |
329 | + return munchify(feature) | ||
328 | 330 | ||
329 | 331 | ||
330 | def test_question_data(): | 332 | def test_question_data(): |
@@ -59,7 +59,7 @@ class OP_Provider(BaseProvider): | @@ -59,7 +59,7 @@ class OP_Provider(BaseProvider): | ||
59 | :example: array('Надіньте', 'фуражка', 'зелено') | 59 | :example: array('Надіньте', 'фуражка', 'зелено') |
60 | :param nb: how many words to return | 60 | :param nb: how many words to return |
61 | """ | 61 | """ |
62 | - return [self.word() for _ in range(0, nb)] | 62 | + return random.sample(self.word_list, nb) |
63 | 63 | ||
64 | @classmethod | 64 | @classmethod |
65 | def sentence(self, nb_words=5, variable_nb_words=True): | 65 | def sentence(self, nb_words=5, variable_nb_words=True): |
Please
register
or
login
to post a comment