Skip to content

Commit

Permalink
Add fa_IR localization for currency provider (#1971)
Browse files Browse the repository at this point in the history
* Add ``fa_IR`` localization for ``currency`` provider

* Add tests for ``fa_IR`` ``currency`` provider
  • Loading branch information
parsariyahi authored Jan 19, 2024
1 parent df5f4b9 commit 28cad39
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions faker/providers/currency/fa_IR/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .. import Provider as CurrencyProvider


class Provider(CurrencyProvider):
price_formats = ["###,###,000","#,###,000,000", "%,###,###,###,###", "%,###,###,###,000,000"]

Check failure on line 5 in faker/providers/currency/fa_IR/__init__.py

View workflow job for this annotation

GitHub Actions / flake8

missing whitespace after ','

def pricetag(self) -> str:
return self.numerify(self.random_element(self.price_formats)) + "\uFDFC"
17 changes: 17 additions & 0 deletions tests/providers/test_currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,23 @@ def test_pricetag(self, faker, num_samples):
assert isinstance(pricetag, str)


class TestFaIr:
"""Test fa_IR currency provider"""

num_samples = 100

@classmethod
def setup_class(cls):
from faker.providers.currency.fa_IR import Provider as FaIrCurrencyProvider

cls.provider = FaIrCurrencyProvider

def test_pricetag(self, faker, num_samples):
for _ in range(num_samples):
pricetag = faker.pricetag()
assert isinstance(pricetag, str)


class TestFrCa:
"""Test fr_CA currency provider"""

Expand Down

0 comments on commit 28cad39

Please sign in to comment.