Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fa_IR localization for currency provider #1971

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]

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