Repository: crsmithdev/arrow
Pull request #769 (2020-04-05 16:55:21)

Add week timeframe to Polish locale
## Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all *appropriate* boxes:

<!-- Check boxes by placing an x in the brackets: [x] -->
- [x] 🧪 Added **tests** for changed code.
- [x] 🛠️ All tests **pass** when run locally (run `tox` or `make test` to find out!).
- [ ] 📚 Updated **documentation** for changed code.
  (:x: No documentation change needed.)
- [x] ⏩ Code is **up-to-date** with the `master` branch.

If you have *any* questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

## Description of Changes

<!--
Replace with description of code changes.

If your PR has an associated issue, insert the issue number (e.g. #703) or directly link to the GitHub issue (e.g. https://github.com/crsmithdev/arrow/issues/703).

For example, doing the following will automatically close issue #703 when this PR is merged:

Closes: #703
-->

I've added missing `week` and `weeks` timeframes to Polish locale and also fixed the grammar errors in the existing entries.


codecov-io: # [Codecov](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=h1) Report
> Merging [#769](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=desc) into [master](https://codecov.io/gh/crsmithdev/arrow/commit/34213790ebbafb743ddcc8fb15d051bc9bd44249&el=desc) will **not change** coverage by `%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/crsmithdev/arrow/pull/769/graphs/tree.svg?width=650&height=150&src=pr&token=4EkGnFsIGn)](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master      #769   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         1696      1681   -15     
  Branches       288       288           
=========================================
- Hits          1696      1681   -15     
```


| [Impacted Files](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [arrow/locales.py](https://codecov.io/gh/crsmithdev/arrow/pull/769/diff?src=pr&el=tree#diff-YXJyb3cvbG9jYWxlcy5weQ==) | `100.00% <ø> (ø)` | |
| [arrow/arrow.py](https://codecov.io/gh/crsmithdev/arrow/pull/769/diff?src=pr&el=tree#diff-YXJyb3cvYXJyb3cucHk=) | `100.00% <0.00%> (ø)` | |
| [arrow/parser.py](https://codecov.io/gh/crsmithdev/arrow/pull/769/diff?src=pr&el=tree#diff-YXJyb3cvcGFyc2VyLnB5) | `100.00% <0.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=footer). Last update [3421379...35c54b7](https://codecov.io/gh/crsmithdev/arrow/pull/769?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

jadchaar: Hey @akwodkiewicz, seems like a recent merge that contained some big changes to our testing suite was merged in and thus caused some conflicts. Mind resolving them so we can merge this in?
systemcatch: Conflicts don't look to bad, I can help with fixing if need be.

Patch:
diff --git a/arrow/locales.py b/arrow/locales.py
index c62d037..dbcfd95 100644
--- a/arrow/locales.py
+++ b/arrow/locales.py
@@ -1242,20 +1242,24 @@ class PolishLocale(SlavicBaseLocale):
     past = "{0} temu"
     future = "za {0}"
 
+    # The nouns should be in genitive case (Polish: "dopełniacz")
+    # in order to correctly form `past` & `future` expressions.
     timeframes = {
         "now": "teraz",
-        "second": "sekunda",
-        "seconds": "{0} kilka sekund",
+        "second": "sekundę",
+        "seconds": ["{0} sekund", "{0} sekundy", "{0} sekund"],
         "minute": "minutę",
         "minutes": ["{0} minut", "{0} minuty", "{0} minut"],
-        "hour": "godzina",
+        "hour": "godzinę",
         "hours": ["{0} godzin", "{0} godziny", "{0} godzin"],
         "day": "dzień",
-        "days": ["{0} dzień", "{0} dni", "{0} dni"],
+        "days": "{0} dni",
+        "week": "tydzień",
+        "weeks": ["{0} tygodni", "{0} tygodnie", "{0} tygodni"],
         "month": "miesiąc",
-        "months": ["{0} miesiąc", "{0} miesiące", "{0} miesięcy"],
+        "months": ["{0} miesięcy", "{0} miesiące", "{0} miesięcy"],
         "year": "rok",
-        "years": ["{0} rok", "{0} lata", "{0} lat"],
+        "years": ["{0} lat", "{0} lata", "{0} lat"],
     }
 
     month_names = [


Test patch:
diff --git a/tests/test_locales.py b/tests/test_locales.py
index 99889e3..28d19e9 100644
--- a/tests/test_locales.py
+++ b/tests/test_locales.py
@@ -216,15 +216,55 @@ class TestRussianLocale:
 @pytest.mark.usefixtures("lang_locale")
 class TestPolishLocale:
     def test_plurals(self):
+
+        assert self.locale._format_timeframe("seconds", 0) == "0 sekund"
+        assert self.locale._format_timeframe("second", 1) == "sekundę"
+        assert self.locale._format_timeframe("seconds", 2) == "2 sekundy"
+        assert self.locale._format_timeframe("seconds", 5) == "5 sekund"
+        assert self.locale._format_timeframe("seconds", 21) == "21 sekund"
+        assert self.locale._format_timeframe("seconds", 22) == "22 sekundy"
+        assert self.locale._format_timeframe("seconds", 25) == "25 sekund"
+
+        assert self.locale._format_timeframe("minutes", 0) == "0 minut"
+        assert self.locale._format_timeframe("minute", 1) == "minutę"
+        assert self.locale._format_timeframe("minutes", 2) == "2 minuty"
+        assert self.locale._format_timeframe("minutes", 5) == "5 minut"
+        assert self.locale._format_timeframe("minutes", 21) == "21 minut"
+        assert self.locale._format_timeframe("minutes", 22) == "22 minuty"
+        assert self.locale._format_timeframe("minutes", 25) == "25 minut"
+
         assert self.locale._format_timeframe("hours", 0) == "0 godzin"
-        assert self.locale._format_timeframe("hours", 1) == "1 godzin"
+        assert self.locale._format_timeframe("hour", 1) == "godzinę"
         assert self.locale._format_timeframe("hours", 2) == "2 godziny"
-        assert self.locale._format_timeframe("hours", 4) == "4 godziny"
         assert self.locale._format_timeframe("hours", 5) == "5 godzin"
         assert self.locale._format_timeframe("hours", 21) == "21 godzin"
         assert self.locale._format_timeframe("hours", 22) == "22 godziny"
         assert self.locale._format_timeframe("hours", 25) == "25 godzin"
 
+        assert self.locale._format_timeframe("weeks", 0) == "0 tygodni"
+        assert self.locale._format_timeframe("week", 1) == "tydzień"
+        assert self.locale._format_timeframe("weeks", 2) == "2 tygodnie"
+        assert self.locale._format_timeframe("weeks", 5) == "5 tygodni"
+        assert self.locale._format_timeframe("weeks", 21) == "21 tygodni"
+        assert self.locale._format_timeframe("weeks", 22) == "22 tygodnie"
+        assert self.locale._format_timeframe("weeks", 25) == "25 tygodni"
+
+        assert self.locale._format_timeframe("months", 0) == "0 miesięcy"
+        assert self.locale._format_timeframe("month", 1) == "miesiąc"
+        assert self.locale._format_timeframe("months", 2) == "2 miesiące"
+        assert self.locale._format_timeframe("months", 5) == "5 miesięcy"
+        assert self.locale._format_timeframe("months", 21) == "21 miesięcy"
+        assert self.locale._format_timeframe("months", 22) == "22 miesiące"
+        assert self.locale._format_timeframe("months", 25) == "25 miesięcy"
+
+        assert self.locale._format_timeframe("years", 0) == "0 lat"
+        assert self.locale._format_timeframe("year", 1) == "rok"
+        assert self.locale._format_timeframe("years", 2) == "2 lata"
+        assert self.locale._format_timeframe("years", 5) == "5 lat"
+        assert self.locale._format_timeframe("years", 21) == "21 lat"
+        assert self.locale._format_timeframe("years", 22) == "22 lata"
+        assert self.locale._format_timeframe("years", 25) == "25 lat"
+
 
 @pytest.mark.usefixtures("lang_locale")
 class TestIcelandicLocale: