0
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Â596_‘I|¥‰ÓMdœv ©ƒ†ü+=ÂÁ T    ‹      ½•]oÚ0†ïû+<_ì.9	Ð–Ò�‰¤¡ñ%Ê4MÓ.Œm‹G¶)£¿~†@a¥e ^Å9~ýžóøÄqð!ê7G?-ôeÔí Á·Ï�vaà{¹	�¢b¢âz>@«‡NŒÉk ‹ÅÂ]”]©b!1³´Ú(A�ËÃáU°Š…W(H8aö‰#LÊÃvÆøo$'äÜhÁxr%)˜DY¡£y:%¥�¹V ¢80;=MÅ˜:s#R@ád½acŒ%[®rúñ·6ë‚Éx�f5Ta`ôHRguldŽÃ@Ìb¤­cTfÆ)É¦n,&‘ÔÔñÏv³ÿËêlîÕê0 È1©ãOÍzï¾_�pØ#3 9¬éZM‡¢šI&&‚³Å…øA<½lšˆkªDn„ÌvR°ˆû¨T¦:'–õÚ$j_UHØk»Aè_›1h[½QÔ[ÂV»êNëv˜	Å©‘j¹)\?fc�ßo_Ñ¦L%âÄà!TžÀ–�Œ¹k¿}B»{Ù†­FÔmá°xîWúOi%¯Tv<ßñ*Èókå
B/«¾6•³\q­9{;ƒ+r»v"b7~ÚòìÇ.Áæ»w_Ïe›gÓL.²ÀÖçß%Š&Ï\»Ð%°Jnõl¬ÿjY�±×¯mà2Ízo*jÏ^ÌS»’­É_¥+9~	•ÊµëÛ#=»}ÏO‘Ê|¹Éü<<Šáß­šäß Ï«yÕ#7G0ÞøÏ‡ÍmÀú® ¸ßÿ U==B       ˆÀ¿Ã‚p¾ÂÁ Y    ‹      Õ–QoÚ0€ßû+<?ìŽPh×6xêH¥¡Q@”iš¦©2±!V;²Œþú98mÓ©hLkQûtwÉåî>ç|vø.v'ßGèóä²�F_?õ{]„k ß» Ñ$ò/ZõF p1À'Öæ§ «Õª¾:¬+=‡É›¥-0V‹ØÖ™e˜„Å3r€Â„Sæ$
­°)'=Éø/¤fÔÂÁ¸ûnm€ñ¥ˆ¹)tË3Èx¦ôºŽA*Æ¥Ù:|dÍF>¶ËeºpªØº¨"x¡Œ.ðŠN7‰U“Ð&hIS1—lUŽI(²92:î`±’¦)•7õ¹˜aDSÛÁ?zÝáOç6)¾&!E‰æ³þØíÎ†�“ÍxôiŸKçsŽIŸ‹2ÅÄLp¶ÕùÊ;_‰Ûí#ïqk‘[¡äƒ+8Ä*j¬R“SÇÚv‰®zyö·Õ ñ£Å��/“¨7öKÂŠÕýÿÿÃdD5—EBóØºW%œÏô^NM~vg¢²t-æ‰Å¡zÒóxg*e\W‰·±ÞÕëeµÊ?Êj6šGµ ¨'(8>m!ô‚õ/ä�T+Ypíð$€’©�/w h(hŸ¶O¶¸!ôe� y²6×¾É0©oEc°$Ùè¯d÷M‘«×nSxùõïySh7Ž–Å‰�É½º;Fóµô“±Ô:„�Ø½üí£i¿]dÓòÌp÷ú±¾tg&^>Àžû¨Ä®o•ä“Šñò“iÇK”×»6×Éü¥ö7¨°
7    B   ˆl–äY>”jeJe@¿q—.JbÑ¿�þBÌ�¬Ü¬†8åhA}à?ÅƒlÄ_ŠI|¥�+Wé3ž¯ÄÃ Ù    import pytest

from bs4.element import (
    CData,
    Comment,
    Declaration,
    Doctype,
    NavigableString,
    RubyParenthesisString,
    RubyTextString,
    Script,
    Stylesheet,
    TemplateString,
)

from . import SoupTest

class TestNavigableString(SoupTest):

    def test_text_acquisition_methods(self):
        # These methods are intended for use against Tag, but they
        # work on NavigableString as well,
        
        s = NavigableString("fee ")
        cdata = CData("fie ")
        comment = Comment("foe ")

        assert "fee " == s.get_text()
        assert "fee" == s.get_text(strip=True)
        assert ["fee "] == list(s.strings)
        assert ["fee"] == list(s.stripped_strings)
        assert ["fee "] == list(s._all_strings())

        assert "fie " == cdata.get_text()
        assert "fie" == cdata.get_text(strip=True)
        assert ["fie "] == list(cdata.strings)
        assert ["fie"] == list(cdata.stripped_strings)
        assert ["fie "] == list(cdata._all_strings())
        
        # Since a Comment isn't normally considered 'text',
        # these methods generally do nothing.
        assert "" == comment.get_text()
        assert [] == list(comment.strings)
        assert [] == list(comment.stripped_strings)
        assert [] == list(comment._all_strings())

        # Unless you specifically say that comments are okay.
        assert "foe" == comment.get_text(strip=True, types=Comment)
        assert "foe " == comment.get_text(types=(Comment, NavigableString))

    def test_string_has_immutable_name_property(self):
        # string.name is defined as None and can't be modified
        string = self.soup("s").string
        assert None == string.name
        with pytest.raises(AttributeError):
            string.name = 'foo'

class TestNavigableStringSubclasses(SoupTest):

    def test_cdata(self):
        # None of the current builders turn CDATA sections into CData
        # objects, but you can create them manually.
        soup = self.soup("")
        cdata = CData("foo")
        soup.insert(1, cdata)
        assert str(soup) == "<![CDATA[foo]]>"
        assert soup.find(string="foo") == "foo"
        assert soup.contents[0] == "foo"

    def test_cdata_is_never_formatted(self):
        """Text inside a CData object is passed into the formatter.

        But the return value is ignored.
        """

        self.count = 0
        def increment(*args):
            self.count += 1
            return "BITTER FAILURE"

        soup = self.soup("")
        cdata = CData("<><><>")
        soup.insert(1, cdata)
        assert b"<![CDATA[<><><>]]>" == soup.encode(formatter=increment)
        assert 1 == self.count

    def test_docty