Skip to content

Commit

Permalink
Fix wrong pricetag format in ru_RU locale (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandede authored Apr 9, 2024
1 parent 89e2069 commit 58a7658
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion faker/providers/currency/ru_RU/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Provider(CurrencyProvider):
("ZWD", "Доллар Зимбабве"),
)

price_formats = ["#,##", "%#,##", "%##,##", "%.###,##", "%#.###,##"]
price_formats = ["#,##", "%#,##", "%##,##", "% ###,##", "%# ###,##"]

def pricetag(self) -> str:
return (
Expand Down
5 changes: 5 additions & 0 deletions tests/providers/test_currency.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -117,6 +119,8 @@ def setup_class(cls):
cls.currencies = cls.provider.currencies
cls.currency_codes, cls.currency_names = tuple(zip(*cls.currencies))

cls.pricetag_pattern = re.compile(r"\d{1,3}(?:\s\d{3})*,\d{2}\sр\.")

def test_currency(self, faker, num_samples):
for _ in range(num_samples):
cur = faker.currency()
Expand All @@ -131,6 +135,7 @@ def test_pricetag(self, faker, num_samples):
for _ in range(num_samples):
pricetag = faker.pricetag()
assert isinstance(pricetag, str)
assert self.pricetag_pattern.fullmatch(pricetag)


class TestCsCz:
Expand Down

0 comments on commit 58a7658

Please sign in to comment.