Commit e1b6bdd20622de77adf72b9b7e981073581e051e
Committed by
GitHub
Merge pull request #82 from openprocurement/master
change generation of feature.enum.title
Showing
2 changed files
with
8 additions
and
6 deletions
| @@ -305,7 +305,8 @@ def test_tender_data_limited(params): | @@ -305,7 +305,8 @@ def test_tender_data_limited(params): | ||
| 305 | 305 | ||
| 306 | 306 | ||
| 307 | def test_feature_data(): | 307 | def test_feature_data(): |
| 308 | - return munchify({ | 308 | + words = fake.words() |
| 309 | + feature = { | ||
| 309 | "code": uuid4().hex, | 310 | "code": uuid4().hex, |
| 310 | "title": field_with_id("f", fake.title()), | 311 | "title": field_with_id("f", fake.title()), |
| 311 | "title_en": field_with_id('f', fake_en.sentence(nb_words=5, variable_nb_words=True)), | 312 | "title_en": field_with_id('f', fake_en.sentence(nb_words=5, variable_nb_words=True)), |
| @@ -314,18 +315,19 @@ def test_feature_data(): | @@ -314,18 +315,19 @@ def test_feature_data(): | ||
| 314 | "enum": [ | 315 | "enum": [ |
| 315 | { | 316 | { |
| 316 | "value": 0.05, | 317 | "value": 0.05, |
| 317 | - "title": fake.word() | 318 | + "title": words[0] |
| 318 | }, | 319 | }, |
| 319 | { | 320 | { |
| 320 | "value": 0.01, | 321 | "value": 0.01, |
| 321 | - "title": fake.word() | 322 | + "title": words[1] |
| 322 | }, | 323 | }, |
| 323 | { | 324 | { |
| 324 | "value": 0, | 325 | "value": 0, |
| 325 | - "title": fake.word() | 326 | + "title": words[2] |
| 326 | } | 327 | } |
| 327 | ] | 328 | ] |
| 328 | - }) | 329 | + } |
| 330 | + return munchify(feature) | ||
| 329 | 331 | ||
| 330 | 332 | ||
| 331 | def test_question_data(): | 333 | 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