Repository: dr-prodigy/python-holidays

Issue:
Holiday names sorting
While I was working on Bolivia holidays one of my tests caught an error with holiday names when two holidays fall on the same day. In this particular case it was one regional holiday (La Tablada in Tarija) and Viernes Santo holiday. In 2022 they both fell on Apr 15, so I had to make a separate test for [this case](https://github.com/dr-prodigy/python-holidays/blob/beta/test/countries/test_bolivia.py#L60). But to test it I needed to know the logic behind how names are combined.

I checked the [code](https://github.com/dr-prodigy/python-holidays/blob/beta/holidays/holiday_base.py#L350) and noticed that there was no "rule" for holiday names order in such cases, and that makes testing much harder. 

@dr-prodigy  Would it be ok to submit a PR with a change to this fundamental logic? 

Discussion:

Patch:
diff --git a/CHANGES b/CHANGES
index 537c4e2e..d0d606d8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,13 +1,28 @@
-Version 0.16
+Version 0.17
 ============
 
 Released ?????? ??, ????
 
+
+
+Version 0.16
+============
+
+Released September 16, 2022
+
+This release is dedicated to Queen Elizabeth II (21 April 1926 – 8 September 2022),
+who lived her long life as a monarch through 2 centuries, in both happy and difficult moments,
+with grace, dignity and an always inspiring strong sense of duty and warm heart.
+Goodbye "Lilibet", you have symbolically been a queen, a mother and a grandmother
+to a lot of us, and will be dearly missed.
+
 - Financial market support review, new method financial_holidays(..) #694 (dr-p)
 - Support for Moldova #695 (Thedand)
 - Support for Bolivia #679, #698 (kasya)
-- UK updates #702 (JPunter)
-- Australia updates #699 (Ryan-McCrory)
+- UK updates #702 (JPunter, violuke)
+- Australia updates #699 (Ryan-McCrory, dr-p)
+- Canada updates #710 (bkthomps)
+- New Zealand updates #708, #709 (dr-p, markhoneth)
 - NYSE updates #693, #696 (kasya)
 
 Version 0.15
diff --git a/holidays/__init__.py b/holidays/__init__.py
index d904d797..a7dc7e5a 100644
--- a/holidays/__init__.py
+++ b/holidays/__init__.py
@@ -34,4 +34,4 @@ from holidays.utils import (
     list_supported_financial,
 )
 
-__version__ = "0.16"
+__version__ = "0.17"
diff --git a/holidays/countries/australia.py b/holidays/countries/australia.py
index 40c505e1..d33ec0bd 100644
--- a/holidays/countries/australia.py
+++ b/holidays/countries/australia.py
@@ -116,12 +116,11 @@ class Australia(HolidayBase):
             self[date(year, JUN, 1) + rd(weekday=MO(+1))] = name
 
         # Sovereign's Birthday
-        if year >= 1952:
+        if 1952 <= year <= 2022:
             name = "Queen's Birthday"
         elif year > 1901:
             name = "King's Birthday"
         if year >= 1936:
-            name = "Queen's Birthday"
             if self.subdiv == "QLD":
                 if year == 2012:
                     self[date(year, JUN, 11)] = "Queen's Diamond Jubilee"
diff --git a/holidays/countries/canada.py b/holidays/countries/canada.py
index 8ed56817..7c474561 100644
--- a/holidays/countries/canada.py
+++ b/holidays/countries/canada.py
@@ -220,6 +220,15 @@ class Canada(HolidayBase):
         if year >= 1894:
             self[date(year, SEP, 1) + rd(weekday=MO)] = "Labour Day"
 
+        # Funeral of Queen Elizabeth II
+        # https://www.narcity.com/provinces-territories-will-have-a-day-off-monday-mourn-queen
+        # TODO: the territories holiday status (NT, NU, YT) is still tentative
+        queen_funeral_observers = ("BC", "NB", "NL", "NS", "PE", "YT")
+        if self.subdiv in queen_funeral_observers and year == 2022:
+            self[
+                date(year, SEP, 19)
+            ] = "Funeral of Her Majesty the Queen Elizabeth II"
+
         # National Day for Truth and Reconciliation
         if self.subdiv in ("MB", "NS") and year >= 2021:
             self[
diff --git a/holidays/countries/cuba.py b/holidays/countries/cuba.py
index ff9d4245..212dd91e 100644
--- a/holidays/countries/cuba.py
+++ b/holidays/countries/cuba.py
@@ -32,7 +32,7 @@ class Cuba(HolidayBase):
         2007 (NOV 19): https://bit.ly/3oFbhaZ
         2013 (DEC 20): https://bit.ly/3zoO3vC
         Note: for holidays that can be moved to a Monday if they fall on a
-              Monday, between 1984 and 2013, the State Committee of Work and
+              Sunday, between 1984 and 2013, the State Committee of Work and
               Social Security would determine if they would be moved to the
               Monday, or if they would stay on the Sunday, presumably depending
               on quotas. After 2013, they always move to Monday. I could not
diff --git a/holidays/countries/new_zealand.py b/holidays/countries/new_zealand.py
index 2aba732b..4916e31e 100644
--- a/holidays/countries/new_zealand.py
+++ b/holidays/countries/new_zealand.py
@@ -114,7 +114,7 @@ class NewZealand(HolidayBase):
                 self[apr25 + rd(weekday=MO)] = name + " (Observed)"
 
         # Sovereign's Birthday
-        if year >= 1952:
+        if 1952 <= year <= 2022:
             name = "Queen's Birthday"
         elif year > 1901:
             name = "King's Birthday"
@@ -197,6 +197,10 @@ class NewZealand(HolidayBase):
         elif year == 2052:
             self[date(year, JUN, 21)] = name
 
+        # Queen Elizabeth II Memorial Day
+        if year == 2022:
+            self[date(year, SEP, 26)] = "Queen Elizabeth II Memorial Day"
+
         # Labour Day
         name = "Labour Day"
         if year >= 1910:
diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py
index c0944ebd..8f6dd641 100644
--- a/holidays/holiday_base.py
+++ b/holidays/holiday_base.py
@@ -357,11 +357,14 @@ class HolidayBase(Dict[date, str]):
 
     def __setitem__(self, key: DateLike, value: str) -> None:
         if key in self:
-            if self.get(key).find(value) < 0 and value.find(self.get(key)) < 0:
-                value = f"{value}, {self.get(key)}"
-            else:
-                value = self.get(key)
-        return dict.__setitem__(self, self.__keytransform__(key), value)
+            # If there are multiple holidays on the same date
+            # order their names alphabetically.
+            delimiter = ", "
+            holiday_names = set(self.get(key).split(delimiter))
+            holiday_names.add(value)
+            value = delimiter.join(sorted(holiday_names))
+
+        dict.__setitem__(self, self.__keytransform__(key), value)
 
     def update(  # type: ignore[override]
         self, *args: Union[Dict[DateLike, str], List[DateLike], DateLike]
diff --git a/setup.cfg b/setup.cfg
index 9e060f32..55ce5ec5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -40,7 +40,7 @@ python_requires = >=3.7
 holidays = py.typed
 
 [bumpversion]
-current_version = 0.16
+current_version = 0.17
 
 [flake8]
 extend-ignore = E203,F401,W503,W504


Test patch:
diff --git a/test/countries/test_brazil.py b/test/countries/test_brazil.py
index 8276f56f..14e3fb5d 100644
--- a/test/countries/test_brazil.py
+++ b/test/countries/test_brazil.py
@@ -282,7 +282,7 @@ class TestBrazil(unittest.TestCase):
         to_holidays = holidays.BR(subdiv="TO")
         self.assertIn("2018-01-01", to_holidays)
         self.assertEqual(
-            to_holidays[date(2018, 1, 1)], "Instalação de Tocantins, Ano novo"
+            to_holidays[date(2018, 1, 1)], "Ano novo, Instalação de Tocantins"
         )
         self.assertIn("2018-09-08", to_holidays)
         self.assertEqual(
diff --git a/test/countries/test_canada.py b/test/countries/test_canada.py
index c8e021a8..3bfd55cf 100644
--- a/test/countries/test_canada.py
+++ b/test/countries/test_canada.py
@@ -367,3 +367,13 @@ class TestCA(unittest.TestCase):
         self.holidays.observed = True
         self.assertIn(date(2009, 12, 28), self.holidays)
         self.assertIn(date(2010, 12, 27), self.holidays)
+
+    def test_queens_funeral(self):
+        observers = ("BC", "NB", "NL", "NS", "PE", "YT")
+        for subdiv in holidays.CA.subdivisions:
+            holidays_canada = holidays.CA(subdiv=subdiv)
+            for year in range(1900, 2100):
+                if year == 2022 and subdiv in observers:
+                    self.assertIn(date(year, 9, 19), holidays_canada)
+                else:
+                    self.assertNotIn(date(year, 9, 19), holidays_canada)
diff --git a/test/countries/test_new_zealand.py b/test/countries/test_new_zealand.py
index 5b70e19d..fd8d7e60 100644
--- a/test/countries/test_new_zealand.py
+++ b/test/countries/test_new_zealand.py
@@ -246,6 +246,7 @@ class TestNZ(unittest.TestCase):
             dt = date(year, 6, day)
             self.assertIn(dt, self.holidays, dt)
             self.assertEqual(self.holidays[dt], "Queen's Birthday")
+        self.assertEqual(self.holidays[date(2023, 6, 5)], "King's Birthday")
 
     def test_matariki(self):
         for dt in [
diff --git a/test/test_holiday_base.py b/test/test_holiday_base.py
index c7d744bd..9c5517f2 100644
--- a/test/test_holiday_base.py
+++ b/test/test_holiday_base.py
@@ -13,11 +13,10 @@ import pickle
 import sys
 import unittest
 import warnings
-
 from datetime import date, datetime, timedelta
-from dateutil.relativedelta import relativedelta, MO
 
 import holidays
+from dateutil.relativedelta import MO, relativedelta
 
 
 class TestBasics(unittest.TestCase):
@@ -261,7 +260,7 @@ class TestBasics(unittest.TestCase):
         )
         na = holidays.MX() + holidays.CA() + holidays.US()
         self.assertEqual(
-            na.get(date(1969, 12, 25)), "Navidad [Christmas], Christmas Day"
+            na.get(date(1969, 12, 25)), "Christmas Day, Navidad [Christmas]"
         )
 
     def test_get_list(self):
@@ -270,12 +269,12 @@ class TestBasics(unittest.TestCase):
         wild = westland + chathams
         self.assertEqual(
             wild[date(1969, 12, 1)],
-            ("West Coast Anniversary Day, Chatham Islands Anniversary Day"),
+            ("Chatham Islands Anniversary Day, West Coast Anniversary Day"),
         )
 
         self.assertEqual(
             wild.get_list(date(1969, 12, 1)),
-            ["West Coast Anniversary Day", "Chatham Islands Anniversary Day"],
+            ["Chatham Islands Anniversary Day", "West Coast Anniversary Day"],
         )
         self.assertEqual(wild.get_list(date(1969, 1, 1)), ["New Year's Day"])
         self.assertEqual(