Commit e742b045d060eeb1571e5a5dbe576f465dd607b8
Committed by
GitHub
Merge pull request #1015 from ivanka12/master
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 | 304 | |
305 | 305 | |
306 | 306 | def test_feature_data(): |
307 | - return munchify({ | |
307 | + words = fake.words() | |
308 | + feature = { | |
308 | 309 | "code": uuid4().hex, |
309 | 310 | "title": field_with_id("f", fake.title()), |
310 | 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 | 314 | "enum": [ |
314 | 315 | { |
315 | 316 | "value": 0.05, |
316 | - "title": fake.word() | |
317 | + "title": words[0] | |
317 | 318 | }, |
318 | 319 | { |
319 | 320 | "value": 0.01, |
320 | - "title": fake.word() | |
321 | + "title": words[1] | |
321 | 322 | }, |
322 | 323 | { |
323 | 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 | 332 | def test_question_data(): | ... | ... |
... | ... | @@ -59,7 +59,7 @@ class OP_Provider(BaseProvider): |
59 | 59 | :example: array('Надіньте', 'фуражка', 'зелено') |
60 | 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 | 64 | @classmethod |
65 | 65 | def sentence(self, nb_words=5, variable_nb_words=True): | ... | ... |
Please
register
or
login
to post a comment