From 48dd086da0e92214d846835aa2861e4b822d41bc Mon Sep 17 00:00:00 2001 From: "M.J. Robeer" Date: Thu, 7 Oct 2021 17:34:27 +0200 Subject: [PATCH] Added currency provider for ``nl_NL`` (#1535) --- faker/providers/currency/nl_NL/__init__.py | 9 +++++++++ tests/providers/test_currency.py | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 faker/providers/currency/nl_NL/__init__.py diff --git a/faker/providers/currency/nl_NL/__init__.py b/faker/providers/currency/nl_NL/__init__.py new file mode 100644 index 0000000000..63094d133d --- /dev/null +++ b/faker/providers/currency/nl_NL/__init__.py @@ -0,0 +1,9 @@ +from faker.providers.currency import Provider as CurrencyProvider + + +class Provider(CurrencyProvider): + + price_formats = ["#,##", "%#,##", "%##,##", "%.###,##", "%#.###,##"] + + def pricetag(self): + return "\N{euro sign}" + self.numerify(self.random_element(self.price_formats)) diff --git a/tests/providers/test_currency.py b/tests/providers/test_currency.py index d63a8a383a..9f16c06f95 100644 --- a/tests/providers/test_currency.py +++ b/tests/providers/test_currency.py @@ -362,3 +362,19 @@ def test_pricetag(self, faker, num_samples): for _ in range(num_samples): pricetag = faker.pricetag() assert isinstance(pricetag, str) + + +class TestNlNl: + """Test nl_NL currency provider""" + + num_samples = 100 + + @classmethod + def setup_class(cls): + from faker.providers.currency.nl_NL import Provider as NlCurrencyProvider + cls.provider = NlCurrencyProvider + + def test_pricetag(self, faker, num_samples): + for _ in range(num_samples): + pricetag = faker.pricetag() + assert isinstance(pricetag, str)