# Path: wikitextparser/_comment_bold_italic.py
# class Bold(BoldItalic):
#     __slots__ = ()
# 
#     @property
#     def _match(self):
#         return BOLD_FULLMATCH(self.string)
# 
# class Comment(SubWikiText):
#     __slots__ = ()
# 
#     @property
#     def contents(self) -> str:
#         """Return contents of this comment."""
#         s = self.string
#         if s[-3:] == '-->':
#             return s[4:-3]
#         return s[4:]
# 
#     @property
#     def comments(self) -> List['Comment']:
#         return []
# 
# class Italic(BoldItalic):
#     __slots__ = 'end_token',
# 
#     def __init__(
#         self,
#         string: Union[str, MutableSequence[str]],
#         _type_to_spans: Optional[Dict[str, List[List[int]]]] = None,
#         _span: Optional[List[int]] = None,
#         _type: Optional[Union[str, int]] = None,
#         end_token: bool = True,
#     ):
#         """Initialize the Italic object.
# 
#         :param end_token: set to True if the italic object ends with a '' token
#             False otherwise.
#         """
#         super().__init__(string, _type_to_spans, _span, _type)
#         self.end_token = end_token
# 
#     @property
#     def _match(self):
#         if self.end_token:
#             return ITALIC_FULLMATCH(self.string)
#         return ITALIC_NOEND_FULLMATCH(self.string)


﻿from wikitextparser import Bold, Comment, Italic

def test_sub_bolds():
    b = Bold("'''A{{{text|'''b'''}}}C'''")
    assert b.get_bolds(recursive=False) == []
    recursive_subbolds = b.get_bolds()
    assert len(recursive_subbolds) == 1  # ?
    assert recursive_subbolds[0]._span_data[:2] == [12, 19]


def test_sub_bolds_italics():
    b = Bold("'''A{{{text|'''b'''}}}C'''")
    assert b.get_bolds_and_italics(recursive=False) == []
    recursive_results = b.get_bolds_and_italics()
    assert len(recursive_results) == 1
    assert recursive_results[0]._span_data[:2] == [12, 19]


def test_sub_italics():
    i = Italic("''A{{{text|''b''}}}C''")
    assert i.get_italics(recursive=False) == []
    recursive_subitalics = i.get_italics()
    assert len(recursive_subitalics) == 1  # ?
    assert recursive_subitalics[0]._span_data[:2] == [11, 16]


def test_ref_text():  # 61
    assert Bold("'''<ref>\n</ref>", ).text == '<ref>\n</ref>'


def test_close_only_comment():

# Path: wikitextparser/_comment_bold_italic.py
# class Bold(BoldItalic):
#     __slots__ = ()
# 
#     @property
#     def _match(self):
#         return BOLD_FULLMATCH(self.string)
# 
# class Comment(SubWikiText):
#     __slots__ = ()
# 
#     @property
#     def contents(self) -> str:
#         """Return contents of this comment."""
#         s = self.string
#         if s[-3:] == '-->':
#             return s[4:-3]
#         return s[4:]
# 
#     @property
#     def comments(self) -> List['Comment']:
#         return []
# 
# class Italic(BoldItalic):
#     __slots__ = 'end_token',
# 
#     def __init__(
#         self,
#         string: Union[str, MutableSequence[str]],
#         _type_to_spans: Optional[Dict[str, List[List[int]]]] = None,
#         _span: Optional[List[int]] = None,
#         _type: Optional[Union[str, int]] = None,
#         end_token: bool = True,
#     ):
#         """Initialize the Italic object.
# 
#         :param end_token: set to True if the italic object ends with a '' token
#             False otherwise.
#         """
#         super().__init__(string, _type_to_spans, _span, _type)
#         self.end_token = end_token
# 
#     @property
#     def _match(self):
#         if self.end_token:
#             return ITALIC_FULLMATCH(self.string)
#         return ITALIC_NOEND_FULLMATCH(self.string)


# Path: tests/test_comment_bold_italic.py
﻿from wikitextparser import Bold, Comment, Italic


def test_sub_bolds():
    b = Bold("'''A{{{text|'''b'''}}}C'''")
    assert b.get_bolds(recursive=False) == []
    recursive_subbolds = b.get_bolds()
    assert len(recursive_subbolds) == 1  # ?
    assert recursive_subbolds[0]._span_data[:2] == [12, 19]


def test_sub_bolds_italics():
    b = Bold("'''A{{{text|'''b'''}}}C'''")
    assert b.get_bolds_and_italics(recursive=False) == []
    recursive_results = b.get_bolds_and_italics()
    assert len(recursive_results) == 1
    assert recursive_results[0]._span_data[:2] == [12, 19]


def test_sub_italics():
    i = Italic("''A{{{text|''b''}}}C''")
    assert i.get_italics(recursive=False) == []
    recursive_subitalics = i.get_italics()
    assert len(recursive_subitalics) == 1  # ?
    assert recursive_subitalics[0]._span_data[:2] == [11, 16]


def test_ref_text():  # 61
    assert Bold("'''<ref>\n</ref>", ).text == '<ref>\n</ref>'


def test_close_only_comment():

    assert Comment('<!--a\nb').contents == 'a\nb'