Example #1
0
def test():
    for _ in range(99):
        fh.check(pyexpat,
                 valid_inputs=[((), {}), ((fh.bool, ), {}), ((fh.int, ), {}),
                               ((fh.str, ), {}), ((fh.bytes, ), {}),
                               ((fh.str, fh.bool), {}), ((fh.str, fh.str), {}),
                               ((fh.bytes, fh.bool), {}),
                               ((fh.file_object, ), {}),
                               ((fh.str, fh.str, fh.dict), {})],
                 expected_exceptions=(TypeError, ValueError))

        fh.check(_elementtree,
                 valid_inputs=[
                     ((), {}),
                     ((fh.dict, ), {}),
                     ((fh.str, ), {}),
                     ((fh.str, fh.dict), {}),
                     ((fh.str, fh.function, fh.str), {}),
                     ((fh.object, fh.object), {}),
                     ((fh.str, fh.str, fh.str), {}),
                     ((fh.list, fh.list), {}),
                     ((fh_element, ), {}),
                     ((
                         fh.int,
                         fh_element,
                     ), {}),
                     ((fh_element_list, ), {}),
                     ((lambda: fh_element, ), {}),
                     ((fh.file_object, ), {}),
                 ],
                 expected_exceptions=(TypeError, ValueError, IndexError),
                 dir_func=fh_dir_func)
def test():
  for _ in range(999):
    fh.check(time,
             valid_inputs = [
                            ((),{}),
                            ((fh.int,),{}),
                            ((fh.tuple,),{}),
                            ((fh.str, fh.tuple),{}),
                            ((fh.str,),{}),
                            ((fh.str, fh.str),{}),
                            ((fh_date, fh_time, fh_tzinfo),{}),
                            ],
             expected_exceptions = (TypeError, ValueError, OSError),
             dir_func = lambda i: set(dir(i))-{'sleep'})

    time.sleep(0)
    
    fh.check(_datetime,
             valid_inputs = [
                            ((),{}),
                            ((fh.int,),{}),
                            ((fh.int, fh.int),{}),
                            ((fh.str,),{}),
                            ((fh.str, fh.str),{}),
                            ((fh.int, fh.int, fh.int),{}),
                            ((fh.int, fh.int, fh.int, fh.int, fh_tzinfo),{}),
                            ((fh.int, fh.int, fh.int, fh.int, fh.int, fh.int),{}),
                            ((fh_date, fh_date),{}),
                            ((fh_date, fh_date, fh_tzinfo),{})
                            ],
             expected_exceptions = (TypeError, ValueError))
Example #3
0
def test():
    for _ in range(9999):
        fh.check(_imp,
                 valid_inputs=[((), {}), ((fh.str, ), {}), ((fh.bytes, ), {}),
                               ((fh_code, fh.str), {}), ((fh_spec, ), {}),
                               ((fh_spec, fh.bool), {}), ((fh_module, ), {}),
                               ((fh.int, fh.bytes), {})],
                 expected_exceptions=(TypeError, AttributeError, ImportError))
def test():
  for _ in range(9999):
    fh.check(_tracemalloc,
             valid_inputs = [
                            ((),{}),
                            ((fh.object,),{}),                           
                            ],
             expected_exceptions = (TypeError, ValueError))
Example #5
0
def test():
    for _ in range(9999):
        fh.check(_warnings,
                 valid_inputs=[((), {}),
                               ((fh.bytes, fh.object, fh.int, fh.bytes), {}),
                               ((fh.bytes, fh.object, fh.bytes, fh.int,
                                 fh.bytes, fh.object, fh.object, fh.object),
                                {})],
                 expected_exceptions=(TypeError))
Example #6
0
def test():
    for _ in range(9999):
        fh.check(_abc,
                 valid_inputs=[
                     ((), {}),
                     ((fh.klass, ), {}),
                     ((fh.klass, fh.klass), {}),
                 ],
                 expected_exceptions=(TypeError, AttributeError))
Example #7
0
def test():
    for _ in range(9999):
        fh.check(_random,
                 valid_inputs=[
                     ((), {}),
                     ((fh.object, ), {}),
                     ((fh_tuple, ), {}),
                 ],
                 expected_exceptions=(TypeError))
Example #8
0
def test():
    for _ in range(9999):
        fh.check(_functools,
                 valid_inputs=[
                     ((), {}),
                     ((fh.tuple, ), {}),
                     ((fh.function), {}),
                     ((fh.function, fh.list, fh.object), {}),
                     ((fh.int, fh.bool), {}),
                 ],
                 expected_exceptions=(TypeError))
def test():
    for _ in range(9999):
        fh.check(_pickle,
                 valid_inputs=[
                     ((), {}), ((fh.object, ), {}), ((fh.bytes, fh.bytes), {}),
                     ((fh.file_object, fh.bool, fh.bytes, fh.bytes), {}),
                     ((fh.object, fh.int, fh.bool), {}),
                     ((fh.object, fh.file_object, fh.int, fh.bool), {}),
                     ((fh.bytes, fh.bool, fh.bytes, fh.bytes), {}),
                     ((fh.file_object, fh.bool, fh.bytes, fh.bytes), {})
                 ],
                 expected_exceptions=(TypeError, ValueError, AttributeError),
                 dir_func=dir_func)
Example #10
0
def test():
    for _ in range(999):
        common_exceptions = (TypeError, ValueError, AttributeError, IndexError,
                             ImportError)

        fh.check(_struct,
                 valid_inputs=[
                     ((fh.str, ), {}),
                     ((fh.bytes, ), {}),
                     ((fh.str, fh.bytes, fh.int), {}),
                     ((fh.str, fh.bytes, fh.int, fh.int), {}),
                     ((fh.str, fh.int), {}),
                     ((fh.str, fh.bytes), {}),
                 ],
                 expected_exceptions=common_exceptions +
                 (LookupError, _struct.error))

        fh.check(_heapq,
                 valid_inputs=[((), {}), ((fh.list, ), {}),
                               ((fh.list, fh.object), {})],
                 expected_exceptions=common_exceptions)

        fh.check(_bisect,
                 valid_inputs=[((fh.list, fh.object, fh.int, fh.int), {})],
                 expected_exceptions=common_exceptions)

        fh.check(_collections,
                 valid_inputs=[((fh.list, ), {}), ((fh.list, fh.int), {}),
                               ((fh.object, ), {}), ((fh.object, fh.int), {}),
                               ((fh.object, fh.int, fh.int), {})],
                 expected_exceptions=common_exceptions + (LookupError, ))
Example #11
0
def test():
  for _ in range(9999):
    fh.check(_csv,
             valid_inputs = [
                            ((),{}),
                            ((fh.int,),{}),                           
                            ((fh.bytes,),{}),                           
                            ((fh.bytes, fh.dict),{}),                           
                            ((fh.list,),{}),                           
                            ((fh.list, fh,bytes),{}),                           
                            ((fh.list, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes),{}),                           
                            ((fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes),{}),                           
                            ((fh.bytes, fh.dict, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes, fh.bytes),{}),                           
                            ],
             expected_exceptions = (TypeError, ValueError, _csv.Error))
Example #12
0
def test():
    for _ in range(9999):
        fh.check(_io,
                 valid_inputs=[
                     ((), {}),
                     ((fh.int, ), {}),
                     ((fh.bytes, ), {}),
                     ((_io.BytesIO, fh.int), {}),
                     ((_io.BytesIO, _io.BytesIO, fh.int), {}),
                     ((_io.BytesIO, _io.BytesIO, fh.int), {}),
                     ((_io.BytesIO, fh.int, fh.int), {}),
                     ((fh.tuple), {}),
                 ],
                 expected_exceptions=(TypeError, AttributeError, ValueError),
                 dir_func=dir_func)
def test():
    for _ in range(99):
        fh.check(builtins,
                 valid_inputs=[((), {}), ((fh.str, ), {}), ((fh.bytes, ), {}),
                               ((fh.list, ), {}), ((fh.list, fh.list), {})],
                 expected_exceptions=(TypeError, ValueError, AttributeError,
                                      IndexError, RuntimeError, SyntaxError,
                                      NameError, KeyError),
                 dir_func=lambda i: set(dir(i)) - {
                     '__import__', 'help', 'exit', 'quit', 'input', 'history',
                     'open', 'breakpoint', 'license', 'copyright', 'print',
                     'credits'
                 })

        fh.check(_operator,
                 valid_inputs=[((fh.object, ), {}),
                               ((fh.object, fh.object), {}),
                               ((fh.list, fh.object), {}),
                               ((fh.dict, fh.object), {})],
                 expected_exceptions=(TypeError, ValueError, IndexError,
                                      ZeroDivisionError, KeyError))
Example #14
0
def test():
  for _ in range(9999):
    fh.check(_opcode, valid_inputs = [((fh.int,),{}), ((fh.int, fh.object),{})], expected_exceptions = (TypeError, ValueError))
    fh.check(_ast, valid_inputs = [((),{})], expected_exceptions = (TypeError, ValueError))
def test():
    warnings.filterwarnings('ignore')
    ucd_map = {
        a: getattr(unicodedata.ucd_3_2_0, a)
        for a in dir(unicodedata.ucd_3_2_0)
    }
    for _ in range(9999):
        for a in {
                **unicodedata.__dict__,
                **ucd_map,
                **_locale.__dict__,
                **_codecs.__dict__
        }.values():
            a
            repr(a)

            try:
                a()
            except (TypeError, UnicodeDecodeError, ValueError):
                pass

            try:
                a(fstr())
            except (TypeError, UnicodeDecodeError, ValueError):
                pass

            try:
                a(str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(fstr(), fstr())
            except (TypeError, UnicodeDecodeError, ValueError):
                pass

            try:
                a(fstr(), str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, LookupError):
                pass

            try:
                a(str(fstr()), str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(fint(), fstr())
            except (TypeError, UnicodeDecodeError, ValueError, OSError):
                pass

            try:
                a(fint(), str(fstr()), str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, OSError):
                pass

            try:
                a(ffunc())
            except (TypeError, UnicodeDecodeError, ValueError, OSError):
                pass

            try:
                a(ffunc(), str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(ffunc(), str(fstr()), str(fstr()))
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(ffunc(), str(fstr()), fbool())
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(ffunc(), str(fstr()), fint(), fbool())
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

            try:
                a(str(fstr()), ffunc())
            except (TypeError, UnicodeDecodeError, ValueError, LookupError,
                    AttributeError):
                pass

        common_inputs = [
            ((), {}),
            ((fh.str, ), {}),
            ((fh.bytes, ), {}),
            ((fh.int, ), {}),
            ((fh.file_object, ), {}),
            ((fh.list, ), {}),
            ((fh.str, fh.str), {}),
            ((fh.str, fh.bool), {}),
        ]

        common_exceptions = (TypeError, ValueError, AttributeError,
                             LookupError)

        fh.check(_multibytecodec,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions,
                 dir_func=fh_dir_func)
        fh.check(_codecs_cn,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)
        fh.check(_codecs_hk,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)
        fh.check(_codecs_jp,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)
        fh.check(_codecs_kr,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)
        fh.check(_codecs_tw,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)
        fh.check(_codecs_iso2022,
                 valid_inputs=common_inputs,
                 expected_exceptions=common_exceptions)