Commit fe57d771f3ef352031671d5a72d5097cb4cd6dac

Authored by selurvedu
1 parent 151e7d07

Fix broken `catch_phrase` for the `ru_RU` locale

1 1 # -*- coding: utf-8 -
2 2 from datetime import timedelta
3 3 from faker import Factory
  4 +from faker.providers.company.en_US import Provider as CompanyProviderEnUs
  5 +from faker.providers.company.ru_RU import Provider as CompanyProviderRuRu
4 6 from munch import munchify
5 7 from uuid import uuid4
6 8 from tempfile import NamedTemporaryFile
... ... @@ -10,10 +12,16 @@ import os
10 12 import random
11 13
12 14
13   -fake = Factory.create('uk_UA')
14   -fake_ru = Factory.create('ru')
15   -fake_en = Factory.create()
16   -fake.add_provider(OP_Provider)
  15 +fake_en = Factory.create(locale='en_US')
  16 +fake_ru = Factory.create(locale='ru_RU')
  17 +fake_uk = Factory.create(locale='uk_UA')
  18 +fake_uk.add_provider(OP_Provider)
  19 +fake = fake_uk
  20 +
  21 +# This workaround fixes an error caused by missing "catch_phrase" class method
  22 +# for the "ru_RU" locale in Faker >= 0.7.4
  23 +fake_ru.add_provider(CompanyProviderEnUs)
  24 +fake_ru.add_provider(CompanyProviderRuRu)
17 25
18 26
19 27 def create_fake_sentence():
... ...
Please register or login to post a comment