# Path: yaspin/constants.py
# ENCODING = "utf-8"


import os
import sys
import uuid
import pytest
from yaspin.constants import ENCODING
~~~~~~~~~~~~~~~~

Checks that scripts with yaspin are safe
for pipes and redirects:

  $ python script_that_uses_yaspin.py > script.log
  $ python script_that_uses_yaspin.py | grep ERROR

"""





TEST_CODE = """\
import time
from yaspin import yaspin, Spinner

with yaspin(Spinner(%s, %s), '%s') as sp:
    time.sleep(0.5)
    sp.fail('🙀')
"""


def to_bytes(str_or_bytes, encoding=ENCODING):
    if isinstance(str_or_bytes, str):
        return str_or_bytes.encode(encoding)
    return str_or_bytes



# Path: yaspin/constants.py
# ENCODING = "utf-8"


# Path: tests/test_pipes.py
import os
import sys
import uuid
import pytest
from yaspin.constants import ENCODING

~~~~~~~~~~~~~~~~

Checks that scripts with yaspin are safe
for pipes and redirects:

  $ python script_that_uses_yaspin.py > script.log
  $ python script_that_uses_yaspin.py | grep ERROR

"""





TEST_CODE = """\
import time
from yaspin import yaspin, Spinner

with yaspin(Spinner(%s, %s), '%s') as sp:
    time.sleep(0.5)
    sp.fail('🙀')
"""


def to_bytes(str_or_bytes, encoding=ENCODING):
    if isinstance(str_or_bytes, str):
        return str_or_bytes.encode(encoding)
    return str_or_bytes



def to_unicode(str_or_bytes, encoding=ENCODING):