Repository: vacanza/holidays
Pull request #2254 (2025-01-29 20:36:56)

Update automatic snapshots update workflow
<!--
  Thanks for contributing to holidays!
-->

## Proposed change

<!--
  Describe the big picture of your changes.
  Don't forget to link your PR to an existing issue if any.
-->

Update automatic snapshots update workflow.

## Type of change

<!--
  Type of change you want to introduce. Please, check one (1) box only!
  If your PR requires multiple boxes to be checked, most likely it needs to
  be split into multiple PRs.
-->

- [ ] New country/market holidays support (thank you!)
- [ ] Supported country/market holidays update (calendar discrepancy fix, localization)
- [x] Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
- [ ] Dependency update (version deprecation/pin/upgrade)
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] Breaking change (a code change causing existing functionality to break)
- [ ] New feature (new `holidays` functionality in general)

## Checklist

<!--
  Put an `x` in the boxes that apply. You can change them after PR is created.
-->

- [x] I've followed the [contributing guidelines][contributing-guidelines]
- [x] I've successfully run `make check`, all checks and tests are green

<!--
  Thanks again for your contribution!
-->

[contributing-guidelines]: https://github.com/vacanza/holidays/blob/dev/CONTRIBUTING.rst
[docs]: https://github.com/vacanza/holidays/tree/dev/docs/source


sonarqubecloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=vacanza_python-holidays&pullRequest=2254) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=vacanza_python-holidays&pullRequest=2254&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=vacanza_python-holidays&pullRequest=2254&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=vacanza_python-holidays&pullRequest=2254&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=vacanza_python-holidays&pullRequest=2254&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=vacanza_python-holidays&pullRequest=2254&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=vacanza_python-holidays&pullRequest=2254)


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/vacanza/holidays/pull/2254?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacanza) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 100.00%. Comparing base [(`a27462a`)](https://app.codecov.io/gh/vacanza/holidays/commit/a27462a2ff9db77e60168585bd809f6c4c109540?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacanza) to head [(`8b3851f`)](https://app.codecov.io/gh/vacanza/holidays/commit/8b3851f3e178cde28b8ca285dcb20b009ec29155?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacanza).
> Report is 2 commits behind head on dev.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##               dev     #2254   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          196       196           
  Lines        11893     11928   +35     
  Branches      1715      1719    +4     
=========================================
+ Hits         11893     11928   +35     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/vacanza/holidays/pull/2254?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacanza).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacanza).


Patch:
diff --git a/.github/workflows/update-snapshots.yml b/.github/workflows/update-snapshots.yml
index ff1af845..bf2f72ce 100644
--- a/.github/workflows/update-snapshots.yml
+++ b/.github/workflows/update-snapshots.yml
@@ -24,7 +24,7 @@ jobs:
           cache: pip
           cache-dependency-path: |
             requirements/build.txt
-            requirements/dev.txt
+            requirements/runtime.txt
           check-latest: true
           python-version: '3.12'
 
@@ -32,9 +32,7 @@ jobs:
         run: |
           python -m pip install --upgrade pip
           python -m pip install -r requirements/build.txt
-          python -m pip install -r requirements/dev.txt
-          make package
-          python -m pip install dist/*.tar.gz
+          python -m pip install -r requirements/runtime.txt
 
       - name: Generate snapshots
         run: |
diff --git a/holidays/countries/sweden.py b/holidays/countries/sweden.py
index 8176085a..ec58132c 100644
--- a/holidays/countries/sweden.py
+++ b/holidays/countries/sweden.py
@@ -30,6 +30,9 @@ class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays):
     Primary sources:
         - https://sv.wikipedia.org/wiki/Helgdagar_i_Sverige
         - http://www.riksdagen.se/sv/dokument-lagar/dokument/svensk-forfattningssamling/lag-1989253-om-allmanna-helgdagar_sfs-1989-253
+        - https://sv.wikipedia.org/wiki/F%C3%B6rsta_maj
+        - https://sv.wikipedia.org/wiki/Sveriges_nationaldag
+        - https://sv.wikipedia.org/wiki/Midsommarafton
     """
 
     country = "SE"
@@ -66,7 +69,6 @@ class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays):
         # Easter Monday.
         self._add_easter_monday(tr("Annandag påsk"))
 
-        # Source: https://sv.wikipedia.org/wiki/F%C3%B6rsta_maj
         if self._year >= 1939:
             # May Day.
             self._add_labor_day(tr("Första maj"))
@@ -74,7 +76,6 @@ class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays):
         # Ascension Day.
         self._add_ascension_thursday(tr("Kristi himmelsfärdsdag"))
 
-        # Source: https://sv.wikipedia.org/wiki/Sveriges_nationaldag
         if self._year >= 2005:
             # National Day of Sweden.
             self._add_holiday_jun_6(tr("Sveriges nationaldag"))
@@ -86,11 +87,6 @@ class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays):
             # Whit Monday.
             self._add_whit_monday(tr("Annandag pingst"))
 
-        # Source:
-        # https://sv.wikipedia.org/wiki/Midsommarafton
-        # https://www.nordiskamuseet.se/aretsdagar/midsommarafton
-        # Midsummer evening. Friday between June 19th and June 25th
-
         # Midsummer Eve.
         name = tr("Midsommarafton")
         dt = (
@@ -102,8 +98,9 @@ class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays):
         # Midsummer Day.
         self._add_holiday(tr("Midsommardagen"), _timedelta(dt, +1))
 
-        # All Saints' Day.
-        self._add_holiday_1st_sat_from_oct_31(tr("Alla helgons dag"))
+        if self._year >= 1953:
+            # All Saints' Day.
+            self._add_holiday_1st_sat_from_oct_31(tr("Alla helgons dag"))
 
         # Christmas Eve.
         self._add_christmas_eve(tr("Julafton"))
diff --git a/requirements/build.txt b/requirements/build.txt
index 4d2398e3..6654e144 100644
--- a/requirements/build.txt
+++ b/requirements/build.txt
@@ -1,3 +1,3 @@
 build==1.2.2.post1
-cyclonedx-bom==5.1.1
+cyclonedx-bom==5.1.2
 polib==1.2.0
diff --git a/requirements/dev.txt b/requirements/dev.txt
index b499668d..da1d07f2 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -7,7 +7,7 @@ hijridate==2.5.0
 lingva==5.0.4
 pre-commit==4.1.0
 pygithub==2.5.0
-ruff==0.9.2
+ruff==0.9.3
 tox==4.24.1
 urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
 zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
diff --git a/snapshots/countries/SE_COMMON.json b/snapshots/countries/SE_COMMON.json
index f327ba1a..c9dbb594 100644
--- a/snapshots/countries/SE_COMMON.json
+++ b/snapshots/countries/SE_COMMON.json
@@ -52,7 +52,6 @@
     "1950-10-15": "Sunday",
     "1950-10-22": "Sunday",
     "1950-10-29": "Sunday",
-    "1950-11-04": "All Saints' Day",
     "1950-11-05": "Sunday",
     "1950-11-12": "Sunday",
     "1950-11-19": "Sunday",
@@ -115,7 +114,6 @@
     "1951-10-14": "Sunday",
     "1951-10-21": "Sunday",
     "1951-10-28": "Sunday",
-    "1951-11-03": "All Saints' Day",
     "1951-11-04": "Sunday",
     "1951-11-11": "Sunday",
     "1951-11-18": "Sunday",
@@ -181,7 +179,6 @@
     "1952-10-12": "Sunday",
     "1952-10-19": "Sunday",
     "1952-10-26": "Sunday",
-    "1952-11-01": "All Saints' Day",
     "1952-11-02": "Sunday",
     "1952-11-09": "Sunday",
     "1952-11-16": "Sunday",


Test patch:
diff --git a/tests/countries/test_sweden.py b/tests/countries/test_sweden.py
index 86cdea23..d7ec40c7 100644
--- a/tests/countries/test_sweden.py
+++ b/tests/countries/test_sweden.py
@@ -20,123 +20,166 @@ class TestSweden(CommonCountryTests, SundayHolidays, TestCase):
     @classmethod
     def setUpClass(cls):
         super().setUpClass(Sweden)
-
-    def setUp(self):
-        super().setUp()
-        self.holidays.include_sundays = False
+        cls.holidays = Sweden(include_sundays=False, years=range(1930, 2050))
 
     def test_country_aliases(self):
         self.assertAliases(Sweden, SE, SWE)
 
-    def test_new_years(self):
-        self.assertHoliday(
-            "1901-01-01",
-            "2017-01-01",
-            "2023-01-01",
-        )
+    def test_new_years_day(self):
+        self.assertHolidayName("Nyårsdagen", (f"{year}-01-01" for year in range(1930, 2050)))
+
+    def test_epiphany(self):
+        self.assertHolidayName("Trettondedag jul", (f"{year}-01-06" for year in range(1930, 2050)))
 
     def test_annunciation(self):
-        self.assertHoliday(
-            "1950-03-25",
-            "1951-03-25",
-            "1952-03-25",
-            "1953-03-25",
-        )
-        self.assertNoHoliday("1954-03-25")
-        self.assertNoHolidayName("Jungfru Marie bebådelsedag", Sweden(years=1954))
+        name = "Jungfru Marie bebådelsedag"
+        self.assertHolidayName(name, (f"{year}-03-25" for year in range(1930, 1954)))
+        self.assertNoHolidayName(name, range(1954, 2050))
 
-    def test_easter(self):
-        self.assertHoliday(
-            "2000-04-21",
-            "2000-04-23",
-            "2000-04-24",
-            "2010-04-02",
-            "2010-04-04",
-            "2010-04-05",
+    def test_good_friday(self):
+        name = "Långfredagen"
+        self.assertHolidayName(
+            name,
+            "2019-04-19",
+            "2020-04-10",
             "2021-04-02",
-            "2021-04-04",
-            "2021-04-05",
+            "2022-04-15",
+            "2023-04-07",
             "2024-03-29",
+        )
+        self.assertHolidayName(name, range(1930, 2050))
+
+    def test_easter_sunday(self):
+        name = "Påskdagen"
+        self.assertHolidayName(
+            name,
+            "2019-04-21",
+            "2020-04-12",
+            "2021-04-04",
+            "2022-04-17",
+            "2023-04-09",
             "2024-03-31",
-            "2024-04-01",
         )
-        self.assertNoHoliday(
-            "2000-04-20",
-            "2010-04-01",
-            "2021-04-01",
-            "2024-03-28",
+        self.assertHolidayName(name, range(1952, 2050))
+
+    def test_easter_monday(self):
+        name = "Annandag påsk"
+        self.assertHolidayName(
+            name,
+            "2019-04-22",
+            "2020-04-13",
+            "2021-04-05",
+            "2022-04-18",
+            "2023-04-10",
+            "2024-04-01",
         )
+        self.assertHolidayName(name, range(1952, 2050))
 
     def test_may_day(self):
-        self.assertHoliday(
-            "1939-05-01",
-            "2017-05-01",
-            "2023-05-01",
+        name = "Första maj"
+        self.assertHolidayName(name, (f"{year}-05-01" for year in range(1939, 2050)))
+        self.assertNoHolidayName(name, range(1930, 1939))
+
+    def test_ascension_day(self):
+        name = "Kristi himmelsfärdsdag"
+        self.assertHolidayName(
+            name,
+            "2019-05-30",
+            "2020-05-21",
+            "2021-05-13",
+            "2022-05-26",
+            "2023-05-18",
+            "2024-05-09",
         )
-        self.assertNoHoliday("1938-05-01")
-        self.assertNoHolidayName("Första maj", Sweden(years=1938))
+        self.assertHolidayName(name, range(1952, 2050))
 
     def test_constitution_day(self):
-        self.assertHoliday(
-            "2005-06-06",
-            "2017-06-06",
-        )
-        self.assertNoHoliday("2004-06-06")
-        self.assertNoHolidayName("Sveriges nationaldag", Sweden(years=2004))
+        name = "Sveriges nationaldag"
+        self.assertHolidayName(name, (f"{year}-06-06" for year in range(2005, 2050)))
+        self.assertNoHolidayName(name, range(1930, 2005))
 
-    def test_pentecost(self):
-        self.assertHoliday(
-            "2000-06-11",
-            "2000-06-12",
-            "2010-05-23",
+    def test_whit_sunday(self):
+        name = "Pingstdagen"
+        self.assertHolidayName(
+            name,
+            "2019-06-09",
+            "2020-05-31",
             "2021-05-23",
-            "2003-06-09",
+            "2022-06-05",
+            "2023-05-28",
             "2024-05-19",
         )
-        self.assertNoHoliday(
-            "2010-05-24",
-            "2021-05-24",
-            "2024-05-20",
+        self.assertHolidayName(name, range(1930, 2050))
+
+    def test_whit_monday(self):
+        name = "Annandag pingst"
+        self.assertHolidayName(
+            name,
+            "1999-05-24",
+            "2000-06-12",
+            "2001-06-04",
+            "2002-05-20",
+            "2003-06-09",
+            "2004-05-31",
         )
-        self.assertNoHolidayName("Annandag pingst", Sweden(years=2005))
+        self.assertHolidayName(name, range(1930, 2005))
+        self.assertNoHolidayName(name, range(2005, 2050))
 
-    def test_midsommar(self):
-        self.assertHoliday(
-            "1950-06-23",
-            "1950-06-24",
-            "1951-06-23",
-            "1951-06-24",
-            "1952-06-23",
-            "1952-06-24",
+    def test_midsummer_eve(self):
+        name = "Midsommarafton"
+        self.assertHolidayName(name, (f"{year}-06-23" for year in range(1930, 1953)))
+        self.assertHolidayName(
+            name,
             "1953-06-19",
-            "1953-06-20",
             "1954-06-25",
-            "1954-06-26",
             "2019-06-21",
-            "2019-06-22",
             "2020-06-19",
-            "2020-06-20",
             "2021-06-25",
-            "2021-06-26",
             "2022-06-24",
+            "2023-06-23",
+            "2024-06-21",
+        )
+        self.assertHolidayName(name, range(1930, 2050))
+
+    def test_midsummer_day(self):
+        name = "Midsommardagen"
+        self.assertHolidayName(name, (f"{year}-06-24" for year in range(1930, 1953)))
+        self.assertHolidayName(
+            name,
+            "1953-06-20",
+            "1954-06-26",
+            "2019-06-22",
+            "2020-06-20",
+            "2021-06-26",
             "2022-06-25",
+            "2023-06-24",
+            "2024-06-22",
         )
-        self.assertNoHoliday(
-            "1952-06-20",
-            "1952-06-21",
-            "1953-06-23",
-            "1953-06-24",
-            "1954-06-23",
-            "1954-06-24",
+        self.assertHolidayName(name, range(1930, 2050))
+
+    def test_all_saints_day(self):
+        name = "Alla helgons dag"
+        self.assertHolidayName(
+            name,
+            "1953-10-31",
+            "1954-11-06",
+            "2019-11-02",
+            "2020-10-31",
+            "2021-11-06",
+            "2022-11-05",
+            "2023-11-04",
+            "2024-11-02",
         )
+        self.assertHolidayName(name, range(1953, 2050))
+        self.assertNoHolidayName(name, range(1930, 1953))
 
     def test_christmas(self):
-        self.assertHoliday(
-            "1901-12-25",
-            "1901-12-26",
-            "2016-12-25",
-            "2016-12-26",
-        )
+        self.assertHolidayName("Julafton", (f"{year}-12-24" for year in range(1930, 2050)))
+        self.assertHolidayName("Juldagen", (f"{year}-12-25" for year in range(1930, 2050)))
+        self.assertHolidayName("Annandag jul", (f"{year}-12-26" for year in range(1930, 2050)))
+
+    def test_new_years_eve(self):
+        self.assertHolidayName("Nyårsafton", (f"{year}-12-31" for year in range(1930, 2050)))
 
     def test_sundays(self):
         self.assertSundays(Sweden)  # Sundays are considered holidays in Sweden.
@@ -156,6 +199,7 @@ class TestSweden(CommonCountryTests, SundayHolidays, TestCase):
 
     def test_2022(self):
         self.assertHolidays(
+            Sweden(include_sundays=False, years=2022),
             ("2022-01-01", "Nyårsdagen"),
             ("2022-01-06", "Trettondedag jul"),
             ("2022-04-15", "Långfredagen"),