From 12ad184120ad7ddebe63462daf3c6f1a64fb4338 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Wed, 25 Jan 2023 16:18:13 -0500 Subject: Tag.interesting_string_types is now propagated when a tag is copied. [bug=1990400] --- CHANGELOG | 3 +++ bs4/element.py | 3 ++- bs4/tests/test_pageelement.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a2134ad..066c8c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,9 @@ Bazaar repository, the final revision to support Python 2 was 605. * The HTMLFormatter and XMLFormatter constructors no longer return a value. [bug=1992693] +* Tag.interesting_string_types is now propagated when a tag is + copied. [bug=1990400] + * Passing a Tag's .contents into PageElement.extend() now works the same way as passing the Tag itself. diff --git a/bs4/element.py b/bs4/element.py index 98e978f..7f25f27 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1309,7 +1309,8 @@ class Tag(PageElement): sourceline=self.sourceline, sourcepos=self.sourcepos, can_be_empty_element=self.can_be_empty_element, cdata_list_attributes=self.cdata_list_attributes, - preserve_whitespace_tags=self.preserve_whitespace_tags + preserve_whitespace_tags=self.preserve_whitespace_tags, + interesting_string_types=self.interesting_string_types ) for attr in ('can_be_empty_element', 'hidden'): setattr(clone, attr, getattr(self, attr)) diff --git a/bs4/tests/test_pageelement.py b/bs4/tests/test_pageelement.py index 26783f2..75bab04 100644 --- a/bs4/tests/test_pageelement.py +++ b/bs4/tests/test_pageelement.py @@ -694,6 +694,7 @@ class TestPersistence(SoupTest): assert tag.can_be_empty_element == copied.can_be_empty_element assert tag.cdata_list_attributes == copied.cdata_list_attributes assert tag.preserve_whitespace_tags == copied.preserve_whitespace_tags + assert tag.interesting_string_types == copied.interesting_string_types def test_unicode_pickle(self): # A tree containing Unicode characters can be pickled. -- cgit v1.2.3