Repository: joke2k/faker
Pull request #1448 (2021-05-20 20:28:21)

Added Hebrew colors
### What does this changes
Allows using Hebrew color names, in the **he_IL** locale.




AndreyRub: Hi, I added some simple tests. Let me know if its ok now
AndreyRub: Is there anything else I can help with?
fcurella: @AndreyRub I've fixed the linting issues but the tests are failing for some reason. I'm trying to figure out why
AndreyRub: Hi, I added another functionality (with a unit test) - Hebrew language names.

AndreyRub: I ran pytest on my end, and it seems to fail on this test 

```
C:\code\faker\tests\providers\conftest.py:27
================================================== warnings summary ===================================================
faker\providers\person\fr_QC\__init__.py:8
tests/test_factory.py::FactoryTestCase::test_documentor
tests/test_providers_formats.py::test_no_invalid_formats[fr_QC]
  C:\code\faker\faker\providers\person\fr_QC\__init__.py:8: UserWarning: fr_QC locale is deprecated. Please use fr_CA.
    warnings.warn("fr_QC locale is deprecated. Please use fr_CA.")

tests/test_factory.py::FactoryTestCase::test_documentor
  C:\code\faker\faker\documentor.py:91: UserWarning: No appropriate country for country code AA
    warnings.warn(str(e))

tests/test_factory.py::FactoryTestCase::test_documentor
  C:\code\faker\faker\documentor.py:91: UserWarning: No appropriate country for country code QC
    warnings.warn(str(e))

tests/test_factory.py::FactoryTestCase::test_documentor
  C:\code\faker\faker\documentor.py:91: UserWarning: Country code cannot be determined from locale
    warnings.warn(str(e))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=============================================== short test summary info ===============================================
ERROR tests/providers/__init__.py::TestBaseProvider::test_locale
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================== 142 passed, 6 warnings, 1 error in 32.53s ======================================
```
same happens in master branch, so I suspect that the tests were broken before I did my changes.
AndreyRub: I've also added vehicle numbers for he_IL locale, together with a unit test.
fcurella: @AndreyRub thank you for your work, but could you add the other providers in separate PRs? It makes it easier to review and fix issues that way.
AndreyRub: > @AndreyRub thank you for your work,, I really appreciate it. Could you add the other providers in separate PRs? It makes it easier to review and fix issues that way.

Sure, no problem. Would you like me to reset this branch and force push to my own repo, and add the other changes in another branch and another PR?
fcurella: > Would you like me to reset this branch and force push to my own repo, and add the other changes in another branch and another PR?

Yes, that will work. Thank you so much.
AndreyRub: > > Would you like me to reset this branch and force push to my own repo, and add the other changes in another branch and another PR?
> 
> Yes, that will work. Thank you so much.

Done. I think I will wait until this PR is merged, and then will branch again from master.
Please let me know if I can help in any way to make this PR happen. Would you like me to do some tests on my end?
fcurella: This one is good! Thank you so much for your patience!

Patch:
diff --git a/faker/providers/color/he_IL/__init__.py b/faker/providers/color/he_IL/__init__.py
new file mode 100644
index 00000000..be1a3fae
--- /dev/null
+++ b/faker/providers/color/he_IL/__init__.py
@@ -0,0 +1,70 @@
+from collections import OrderedDict
+
+from .. import Provider as ColorProvider
+
+localized = True
+
+
+class Provider(ColorProvider):
+    """Implement color provider for ``he_IL`` locale."""
+    """Source : https://he.wikipedia.org/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%A2%D7%A8%D7%9B%D7%AA_%D7%A6%D7%91%D7%A2%D7%99%D7%9D#%D7%98%D7%91%D7%9C%D7%94_%D7%96%D7%95_%D7%9E%D7%A8%D7%90%D7%94_%D7%90%D7%AA_%D7%98%D7%95%D7%95%D7%97_%D7%94%D7%92%D7%95%D7%95%D7%A0%D7%99%D7%9D_%D7%A9%D7%9C_%D7%9B%D7%9E%D7%94_%D7%A6%D7%91%D7%A2%D7%99%D7%9D_%D7%A0%D7%A4%D7%95%D7%A6%D7%99%D7%9D"""  # NOQA
+
+    all_colors = OrderedDict((
+        ("אדום",
+            "#FF0000"),
+        ("אוכרה",
+            "#DDAA33"),
+        ("אינדיגו",
+            "#4B0082"),
+        ("אפור",
+            "#7F7F7F"),
+        ("ארגמן",
+            "#7F003F"),
+        ("ורוד",
+            "#FF007F"),
+        ("זהב",
+            "#FFDF00"),
+        ("חאקי",
+            "#C3B091"),
+        ("חום",
+            "#7F3F00"),
+        ("טורקיז",
+            "#40E0D0"),
+        ("ירוק",
+            "#00FF00"),
+        ("כחול",
+            "#0000FF"),
+        ("כסף",
+            "#C0C0C0"),
+        ("כתום",
+            "#FF7F00"),
+        ("לבן",
+            "#FFFFFF"),
+        ("מג'נטה",
+            "#FF00FF"),
+        ("סגול",
+            "#7F00FF"),
+        ("צהוב",
+            "#FFFF00"),
+        ("ציאן",
+            "#00FFFF"),
+        ("קרדינל",
+            "#C41E3A"),
+        ("שחור",
+            "#000000"),
+        ("שני",
+            "#7F0000"),
+        ("תכלת",
+            "#007FFF"),
+
+    ))
+
+    safe_colors = (
+       "אדום",
+       "ירוק",
+       "כחול",
+       "צהוב",
+       "ציאן",
+       "מג'נטה",
+       "לבן",
+    )


Test patch:
diff --git a/tests/providers/test_color.py b/tests/providers/test_color.py
index 0d1e8c4a..328e7217 100644
--- a/tests/providers/test_color.py
+++ b/tests/providers/test_color.py
@@ -7,6 +7,7 @@ import pytest
 from faker.providers.color import RandomColor
 from faker.providers.color.es_ES import Provider as EsEsColorProvider
 from faker.providers.color.fa_IR import Provider as FaIrColorProvider
+from faker.providers.color.he_IL import Provider as HeILColorProvider
 from faker.providers.color.hy_AM import Provider as HyAmColorProvider
 from faker.providers.color.sk_SK import Provider as SkSkColorProvider
 
@@ -301,3 +302,19 @@ class TestSkSk:
             safe_color_name = faker.safe_color_name()
             assert isinstance(safe_color_name, str)
             assert safe_color_name in SkSkColorProvider.safe_colors
+
+
+class TestHeIl:
+    """Test he_IL color provider methods"""
+
+    def test_color_name(self, faker, num_samples):
+        for _ in range(num_samples):
+            color_name = faker.color_name()
+            assert isinstance(color_name, str)
+            assert color_name in HeILColorProvider.all_colors.keys()
+
+    def test_safe_color_name(self, faker, num_samples):
+        for _ in range(num_samples):
+            safe_color_name = faker.safe_color_name()
+            assert isinstance(safe_color_name, str)
+            assert safe_color_name in HeILColorProvider.safe_colors