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

Fix wrong pricetag format in ru_RU locale #2018

Merged
merged 4 commits into from
Apr 9, 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
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