# Path: app/src/main/python/chaquopy/test/test_utils.py
# API_LEVEL = None
# 
# class FilterWarningsCase(TestCase):
# 
#     def setUp(self):
#         super().setUp()
#         self.cw = catch_warnings()
#         self.cw.__enter__()
#         filterwarnings("error")
# 
#     def tearDown(self):
#         self.cw.__exit__(None, None, None)
#         super().tearDown()


import calendar
import imp
import importlib.util
import marshal
import os
import pkgutil
import platform
import re
import subprocess
import sys
import types
import unittest
        import murmurhash.about
            import murmurhash
            import json
        import imp_rename_two  # Original
        import imp_rename_2    # Renamed
        import pth_generated
        import murmurhash.tests
        import pkg_resources as pr
        import pkg_resources as pr
        import pkg_resources as pr
        import ctypes
        import datetime
        import hashlib
        import locale
        import random
        import time
        import pickle
        import platform
        import select
        import selectors
        import sqlite3
        import distutils.sysconfig
        import sysconfig
        import tempfile
        import time
from contextlib import contextmanager
from importlib import import_module, metadata, reload, resources
from importlib.util import cache_from_source, MAGIC_NUMBER
from os.path import dirname, exists, join, realpath, splitext
from shutil import rmtree
from traceback import format_exc
from .test_utils import API_LEVEL, FilterWarningsCase
    from android.os import Build
    from com.chaquo.python.android import AndroidPlatform
    from java.android import importer
            from package1 import syntax_error  # noqa
            from package1 import recursive_import_error  # noqa
            from package1 import recursive_other_error  # noqa
        from murmurhash import mrmr
        from imp_rename_2 import mod_one, pkg_two
        from com.chaquo.python.demo import TestAndroidReflect as TAR
        from ctypes.util import find_library
        from murmurhash import mrmr
        from json import encoder, scanner
        from lib2to3 import pygram  # noqa: F401
        from multiprocessing.dummy import Pool
        from multiprocessing import get_context, synchronize
        from urllib.request import urlopen
        from android.util import Log
                stream = getattr(sys, stream_name)
                self.check_output_properties(stream)

                def write(s, lines=None):
                    self.assertEqual(len(s), stream.write(s))
                    if lines is None:
                        lines = [s]
                    self.expect_log(level, stream_name, lines)

                write("", [])
                write("a")
                write("Hello")
                write("Hello world")
                write(" ")
                write("  ")

                # The maximum line length is 4000.
                write("foobar" * 700, [("foobar" * 666) + "foob",
                                       "ar" + ("foobar" * 33)])

                # TODO #5730: max line length should be measured in bytes.
                # These are the "full-width" digits 0-9, which encode in UTF-8 as 3 bytes each.
                # write("\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19" * 150,
                #       ["TODO"])

                # Non-ASCII text
                write("ol\u00e9")  # Spanish
                write("\u4e2d\u6587")  # Chinese

                # Non-BMP emoji

# Path: app/src/main/python/chaquopy/test/test_utils.py
# API_LEVEL = None
# 
# class FilterWarningsCase(TestCase):
# 
#     def setUp(self):
#         super().setUp()
#         self.cw = catch_warnings()
#         self.cw.__enter__()
#         filterwarnings("error")
# 
#     def tearDown(self):
#         self.cw.__exit__(None, None, None)
#         super().tearDown()


# Path: app/src/main/python/chaquopy/test/test_android.py
import calendar
import imp
import importlib.util
import marshal
import os
import pkgutil
import platform
import re
import subprocess
import sys
import types
import unittest
        import murmurhash.about
            import murmurhash
            import json
        import imp_rename_two  # Original
        import imp_rename_2    # Renamed
        import pth_generated
        import murmurhash.tests
        import pkg_resources as pr
        import pkg_resources as pr
        import pkg_resources as pr
        import ctypes
        import datetime
        import hashlib
        import locale
        import random
        import time
        import pickle
        import platform
        import select
        import selectors
        import sqlite3
        import distutils.sysconfig
        import sysconfig
        import tempfile
        import time
from contextlib import contextmanager
from importlib import import_module, metadata, reload, resources
from importlib.util import cache_from_source, MAGIC_NUMBER
from os.path import dirname, exists, join, realpath, splitext
from shutil import rmtree
from traceback import format_exc
from .test_utils import API_LEVEL, FilterWarningsCase
    from android.os import Build
    from com.chaquo.python.android import AndroidPlatform
    from java.android import importer
            from package1 import syntax_error  # noqa
            from package1 import recursive_import_error  # noqa
            from package1 import recursive_other_error  # noqa
        from murmurhash import mrmr
        from imp_rename_2 import mod_one, pkg_two
        from com.chaquo.python.demo import TestAndroidReflect as TAR
        from ctypes.util import find_library
        from murmurhash import mrmr
        from json import encoder, scanner
        from lib2to3 import pygram  # noqa: F401
        from multiprocessing.dummy import Pool
        from multiprocessing import get_context, synchronize
        from urllib.request import urlopen
        from android.util import Log

                stream = getattr(sys, stream_name)
                self.check_output_properties(stream)

                def write(s, lines=None):
                    self.assertEqual(len(s), stream.write(s))
                    if lines is None:
                        lines = [s]
                    self.expect_log(level, stream_name, lines)

                write("", [])
                write("a")
                write("Hello")
                write("Hello world")
                write(" ")
                write("  ")

                # The maximum line length is 4000.
                write("foobar" * 700, [("foobar" * 666) + "foob",
                                       "ar" + ("foobar" * 33)])

                # TODO #5730: max line length should be measured in bytes.
                # These are the "full-width" digits 0-9, which encode in UTF-8 as 3 bytes each.
                # write("\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19" * 150,
                #       ["TODO"])

                # Non-ASCII text
                write("ol\u00e9")  # Spanish
                write("\u4e2d\u6587")  # Chinese

                # Non-BMP emoji

                write("\U0001f600", [r"\xed\xa0\xbd\xed\xb8\x80" if API_LEVEL < 23