# Path: yaspin/api.py
# def yaspin(*args, **kwargs):
#     """Display spinner in stdout.
# 
#     Can be used as a context manager or as a function decorator.
# 
#     Arguments:
#         spinner (base_spinner.Spinner, optional): Spinner object to use.
#         text (str, optional): Text to show along with spinner.
#         color (str, optional): Spinner color.
#         on_color (str, optional): Color highlight for the spinner.
#         attrs (list, optional): Color attributes for the spinner.
#         reversal (bool, optional): Reverse spin direction.
#         side (str, optional): Place spinner to the right or left end
#             of the text string.
#         sigmap (dict, optional): Maps POSIX signals to their respective
#             handlers.
#         timer (bool, optional): Prints a timer showing the elapsed time.
# 
#     Returns:
#         core.Yaspin: instance of the Yaspin class.
# 
#     Raises:
#         ValueError: If unsupported ``color`` is specified.
#         ValueError: If unsupported ``on_color`` is specified.
#         ValueError: If unsupported color attribute in ``attrs``
#             is specified.
#         ValueError: If trying to register handler for SIGKILL signal.
#         ValueError: If unsupported ``side`` is specified.
# 
#     Available text colors:
#         red, green, yellow, blue, magenta, cyan, white.
# 
#     Available text highlights:
#         on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan,
#         on_white, on_grey.
# 
#     Available attributes:
#         bold, dark, underline, blink, reverse, concealed.
# 
#     Example::
# 
#         # Use as a context manager
#         with yaspin():
#             some_operations()
# 
#         # Context manager with text
#         with yaspin(text="Processing..."):
#             some_operations()
# 
#         # Context manager with custom sequence
#         with yaspin(Spinner('-\\|/', 150)):
#             some_operations()
# 
#         # As decorator
#         @yaspin(text="Loading...")
#         def foo():
#             time.sleep(5)
# 
#         foo()
# 
#     """
#     return Yaspin(*args, **kwargs)
# 
# Path: yaspin/base_spinner.py
# class Spinner:
#     frames: str
#     interval: int
# 
# Path: yaspin/base_spinner.py
# class Spinner:
# 
# Path: yaspin/helpers.py
# def to_unicode(text_type, encoding=ENCODING):
#     if isinstance(text_type, bytes):
#         return text_type.decode(encoding)
#     return text_type


import pytest
from yaspin import Spinner, yaspin
from yaspin.base_spinner import default_spinner
from yaspin.helpers import to_unicode
    assert sp._spinner == default_spinner
    assert isinstance(sp._frames, str)
    assert sp._interval == sp._spinner.interval * 0.001
    assert isinstance(repr(sp), str)

    new_spinner = Spinner(frames, interval)
    sp.spinner = new_spinner
    assert sp._spinner == sp._set_spinner(new_spinner)

    assert not isinstance(sp._frames, bytes)

    if isinstance(sp._frames, (list, tuple)):
        assert isinstance(sp._frames[0], str)

    assert sp._interval == sp._spinner.interval * 0.001
    assert isinstance(repr(sp), str)


#
# Yaspin.text
#
def test_text_getter(text):
    sp = yaspin(text=text)
    assert sp.text == to_unicode(text)


def test_text_setter(text):
    sp = yaspin()
    sp.text = text
    assert isinstance(sp._text, str)

# Path: yaspin/api.py
# def yaspin(*args, **kwargs):
#     """Display spinner in stdout.
# 
#     Can be used as a context manager or as a function decorator.
# 
#     Arguments:
#         spinner (base_spinner.Spinner, optional): Spinner object to use.
#         text (str, optional): Text to show along with spinner.
#         color (str, optional): Spinner color.
#         on_color (str, optional): Color highlight for the spinner.
#         attrs (list, optional): Color attributes for the spinner.
#         reversal (bool, optional): Reverse spin direction.
#         side (str, optional): Place spinner to the right or left end
#             of the text string.
#         sigmap (dict, optional): Maps POSIX signals to their respective
#             handlers.
#         timer (bool, optional): Prints a timer showing the elapsed time.
# 
#     Returns:
#         core.Yaspin: instance of the Yaspin class.
# 
#     Raises:
#         ValueError: If unsupported ``color`` is specified.
#         ValueError: If unsupported ``on_color`` is specified.
#         ValueError: If unsupported color attribute in ``attrs``
#             is specified.
#         ValueError: If trying to register handler for SIGKILL signal.
#         ValueError: If unsupported ``side`` is specified.
# 
#     Available text colors:
#         red, green, yellow, blue, magenta, cyan, white.
# 
#     Available text highlights:
#         on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan,
#         on_white, on_grey.
# 
#     Available attributes:
#         bold, dark, underline, blink, reverse, concealed.
# 
#     Example::
# 
#         # Use as a context manager
#         with yaspin():
#             some_operations()
# 
#         # Context manager with text
#         with yaspin(text="Processing..."):
#             some_operations()
# 
#         # Context manager with custom sequence
#         with yaspin(Spinner('-\\|/', 150)):
#             some_operations()
# 
#         # As decorator
#         @yaspin(text="Loading...")
#         def foo():
#             time.sleep(5)
# 
#         foo()
# 
#     """
#     return Yaspin(*args, **kwargs)
# 
# Path: yaspin/base_spinner.py
# class Spinner:
#     frames: str
#     interval: int
# 
# Path: yaspin/base_spinner.py
# class Spinner:
# 
# Path: yaspin/helpers.py
# def to_unicode(text_type, encoding=ENCODING):
#     if isinstance(text_type, bytes):
#         return text_type.decode(encoding)
#     return text_type


# Path: tests/test_properties.py
import pytest
from yaspin import Spinner, yaspin
from yaspin.base_spinner import default_spinner
from yaspin.helpers import to_unicode

    assert sp._spinner == default_spinner
    assert isinstance(sp._frames, str)
    assert sp._interval == sp._spinner.interval * 0.001
    assert isinstance(repr(sp), str)

    new_spinner = Spinner(frames, interval)
    sp.spinner = new_spinner
    assert sp._spinner == sp._set_spinner(new_spinner)

    assert not isinstance(sp._frames, bytes)

    if isinstance(sp._frames, (list, tuple)):
        assert isinstance(sp._frames[0], str)

    assert sp._interval == sp._spinner.interval * 0.001
    assert isinstance(repr(sp), str)


#
# Yaspin.text
#
def test_text_getter(text):
    sp = yaspin(text=text)
    assert sp.text == to_unicode(text)


def test_text_setter(text):
    sp = yaspin()
    sp.text = text
    assert isinstance(sp._text, str)

    assert sp._text == to_unicode(text)