Repository: dr-prodigy/python-holidays

Issue:
Cannot "Pop" Combined Texas Emancipation/Juneteenth Holiday
Creating a holiday using TX as the state, there is the combined holiday 'Emancipation Day In Texas; Juneteenth National Independence Day'

Previous versions of python-holidays seemed to treat this concatenation with a comma a such: 'Emancipation Day In Texas, Juneteenth National Independence Day'

I am able to 'pop_named' the holiday in the older version, not in the newer with the semicolon seperator:

python3.6/holidays 0.11.3.1:
![image](https://github.com/dr-prodigy/python-holidays/assets/38263272/0de82f34-1c46-400b-859a-b7d87f7c8703)

python 3.10/holidays .25:
![image](https://github.com/dr-prodigy/python-holidays/assets/38263272/381017f6-0d49-49d3-9b09-f4e5c85b31f0)



Comments:

Patch:
diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py
index 0690d59c..ccffa40c 100644
--- a/holidays/holiday_base.py
+++ b/holidays/holiday_base.py
@@ -724,7 +724,12 @@ class HolidayBase(Dict[date, str]):
             if name
         ]
 
-    def get_named(self, holiday_name: str, lookup="icontains") -> List[date]:
+    def get_named(
+        self,
+        holiday_name: str,
+        lookup="icontains",
+        split_multiple_names=True,
+    ) -> List[date]:
         """Return a list of all holiday dates matching the provided holiday
         name. The match will be made case insensitively and partial matches
         will be included by default.
@@ -739,12 +744,17 @@ class HolidayBase(Dict[date, str]):
                 icontains - case insensitive contains match;
                 iexact - case insensitive exact match;
                 istartswith - case insensitive starts with match;
+        :param split_multiple_names:
+            Either use the exact name for each date or split it by holiday
+            name delimiter.
 
         :return:
             A list of all holiday dates matching the provided holiday name.
         """
         holiday_date_names_mapping: Dict[date, List[str]] = {
             key: value.split(HOLIDAY_NAME_DELIMITER)
+            if split_multiple_names
+            else [value]
             for key, value in self.items()
         }
 
@@ -849,14 +859,24 @@ class HolidayBase(Dict[date, str]):
         :raise:
             KeyError if date is not a holiday and default is not given.
         """
-        dates = self.get_named(name)
-        if not dates:
+        use_exact_name = HOLIDAY_NAME_DELIMITER in name
+        dts = self.get_named(name, split_multiple_names=not use_exact_name)
+        if len(dts) == 0:
             raise KeyError(name)
 
-        for dt in dates:
+        popped = []
+        for dt in dts:
+            holiday_names = self[dt].split(HOLIDAY_NAME_DELIMITER)
             self.pop(dt)
+            popped.append(dt)
 
-        return dates
+            # Keep the rest of holidays falling on the same date.
+            if not use_exact_name:
+                holiday_names.remove(name)
+                if len(holiday_names) > 0:
+                    self[dt] = HOLIDAY_NAME_DELIMITER.join(holiday_names)
+
+        return popped
 
     def update(  # type: ignore[override]
         self, *args: Union[Dict[DateLike, str], List[DateLike], DateLike]


Test patch:
diff --git a/tests/countries/test_isle_of_man.py b/tests/countries/test_isle_of_man.py
index 157f6956..28a72bec 100644
--- a/tests/countries/test_isle_of_man.py
+++ b/tests/countries/test_isle_of_man.py
@@ -21,6 +21,17 @@ class TestIM(TestCase):
     def test_country_aliases(self):
         self.assertCountryAliases(IsleOfMan, IM, IMN)
 
+    def test_1970(self):
+        self.assertHolidays(
+            ("1970-03-27", "Good Friday"),
+            ("1970-03-30", "Easter Monday"),
+            ("1970-06-05", "TT Bank Holiday"),
+            ("1970-07-05", "Tynwald Day"),
+            ("1970-12-25", "Christmas Day"),
+            ("1970-12-26", "Boxing Day"),
+            ("1970-12-28", "Boxing Day (Observed)"),
+        )
+
     def test_2022(self):
         self.assertHolidays(
             ("2022-01-01", "New Year's Day"),
diff --git a/tests/test_holiday_base.py b/tests/test_holiday_base.py
index f6d36473..ffd27a9a 100644
--- a/tests/test_holiday_base.py
+++ b/tests/test_holiday_base.py
@@ -21,6 +21,7 @@ from dateutil.relativedelta import relativedelta as rd
 
 import holidays
 from holidays.constants import JAN, FEB, OCT, MON, TUE, SAT, SUN
+from holidays.constants import HOLIDAY_NAME_DELIMITER
 
 
 class TestBasics(unittest.TestCase):
@@ -119,15 +120,60 @@ class TestBasics(unittest.TestCase):
         self.assertNotIn(date(2014, 1, 1), self.holidays)
         self.assertIn(date(2014, 7, 4), self.holidays)
 
-    def test_pop_named(self):
+    def test_pop_named_single(self):
         self.assertIn(date(2014, 1, 1), self.holidays)
-        self.holidays.pop_named("New Year's Day")
-        self.assertNotIn(date(2014, 1, 1), self.holidays)
+        dts = self.holidays.pop_named("New Year's Day")
+        for dt in dts:
+            self.assertNotIn(dt, self.holidays)
+
+    def test_pop_named_multiple(self):
+        dt = date(2022, 2, 22)
+        holiday_name_1 = "Holiday Name 1"
+        holiday_name_2 = "Holiday Name 2"
+        holiday_name_3 = "Holiday Name 3"
+        combined_name = HOLIDAY_NAME_DELIMITER.join(
+            (holiday_name_1, holiday_name_2, holiday_name_3)
+        )
+        self.holidays[dt] = holiday_name_1
+        self.holidays[dt] = holiday_name_2
+        self.holidays[dt] = holiday_name_3
+        self.assertEqual(self.holidays[dt], combined_name)
+
+        # Pop the entire date by multiple holidays exact name.
+        self.holidays.pop_named(combined_name)
+        self.assertNotIn(dt, self.holidays)
+
+        # Pop only one holiday by a single name.
+        self.holidays[dt] = holiday_name_1
+        self.holidays[dt] = holiday_name_2
+        self.holidays[dt] = holiday_name_3
+        self.assertEqual(self.holidays[dt], combined_name)
+
+        self.holidays.pop_named(holiday_name_1)
+        self.assertEqual(
+            self.holidays[dt],
+            HOLIDAY_NAME_DELIMITER.join((holiday_name_2, holiday_name_3)),
+        )
+
+        self.holidays.pop_named(holiday_name_3)
+        self.assertEqual(self.holidays[dt], holiday_name_2)
+
+        self.holidays.pop_named(holiday_name_2)
+        self.assertNotIn(dt, self.holidays)
+
+    def test_pop_named_exception(self):
         self.assertRaises(
             KeyError,
             lambda: self.holidays.pop_named("New Year's Dayz"),
         )
 
+        self.assertIn(date(2022, 1, 1), self.holidays)
+        self.holidays.pop_named("New Year's Day")
+        self.assertRaises(
+            KeyError,
+            lambda: self.holidays.pop_named("New Year's Day"),
+        )
+
     def test_setitem(self):
         self.holidays = holidays.US(years=[2014])
         self.assertEqual(len(self.holidays), 10)