bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | 457,000 |
def parse_response(self, response): # read response data from httpresponse, and parse it if response.getheader("Content-Encoding", "") == "gzip": stream = GzipDecodedResponse(response) else: stream = response | def parse_response(self, response): # read response data from httpresponse, and parse it if hasattr(response,'getheader'): if response.getheader("Content-Encoding", "") == "gzip": stream = GzipDecodedResponse(response) else: stream = response else: stream = response | 457,001 |
def test_undecodable_code(self): # Raise SkipTest() if sys.executable is not encodable to ascii test.support.workaroundIssue8611() | def test_undecodable_code(self): # Raise SkipTest() if sys.executable is not encodable to ascii test.support.workaroundIssue8611() | 457,002 |
def test_undecodable_code(self): # Raise SkipTest() if sys.executable is not encodable to ascii test.support.workaroundIssue8611() | def test_undecodable_code(self): # Raise SkipTest() if sys.executable is not encodable to ascii test.support.workaroundIssue8611() | 457,003 |
def lookup(caps, MIMEtype, key=None): entries = [] if MIMEtype in caps: entries = entries + caps[MIMEtype] MIMEtypes = MIMEtype.split('/') MIMEtype = MIMEtypes[0] + '/*' if MIMEtype in caps: entries = entries + caps[MIMEtype] if key is not None: entries = filter(lambda e, key=key: key in e, entries) return entries | def lookup(caps, MIMEtype, key=None): entries = [] if MIMEtype in caps: entries = entries + caps[MIMEtype] MIMEtypes = MIMEtype.split('/') MIMEtype = MIMEtypes[0] + '/*' if MIMEtype in caps: entries = entries + caps[MIMEtype] if key is not None: entries = [e for e in entries if key in e] return entries | 457,004 |
def test(): import time, builtins #Just a quick sanity check correct_result = builtins.range(5, 100, 3) oldrange_result = list(oldrange(5, 100, 3)) genrange_result = list(genrange(5, 100, 3)) if genrange_result != correct_result or oldrange_result != correct_result: raise Exception("error in implementation:\ncorrect ... | def test(): import time, builtins #Just a quick sanity check correct_result = list(builtins.range(5, 100, 3)) oldrange_result = list(oldrange(5, 100, 3)) genrange_result = list(genrange(5, 100, 3)) if genrange_result != correct_result or oldrange_result != correct_result: raise Exception("error in implementation:\ncorr... | 457,005 |
def __init__(self, typecode, newarg=None): array.array.__init__(typecode) | def __init__(self, typecode, newarg=None): array.array.__init__(typecode) | 457,006 |
def _handle_message(self, msg): s = StringIO() g = self.clone(s) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart. Extract that object, stringify it, and # write it out. # Except, it turns out, when it's ... | def _handle_message(self, msg): s = StringIO() g = self.clone(s) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message # object for the subpart. Extract that object, stringify it, and # write it out. # Except, it turns out, when it's ... | 457,007 |
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 457,008 |
def write_results(self, show_missing=True, summary=False, coverdir=None): """ @param coverdir """ if self.calledfuncs: print() print("functions called:") calls = self.calledfuncs for filename, modulename, funcname in sorted(calls): print(("filename: %s, modulename: %s, funcname: %s" % (filename, modulename, funcname))) | def write_results(self, show_missing=True, summary=False, coverdir=None): """ @param coverdir """ if self.calledfuncs: print() print("functions called:") calls = self.calledfuncs for filename, modulename, funcname in sorted(calls): print(("filename: %s, modulename: %s, funcname: %s" % (filename, modulename, funcname))) | 457,009 |
def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | def write_results_file(self, path, lines, lnotab, lines_hit, encoding=None): """Return a coverage results file in path.""" | 457,010 |
def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" | 457,011 |
def get(python): cmd = [python, '-c', 'import sysconfig; print sysconfig.get_platform()'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p.communicate() | def get(python): cmd = [python, '-c', 'import sysconfig; print sysconfig.get_platform()'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE) return p.communicate() | 457,012 |
def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. """ return s.replace(old, new, maxsplit) | def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. A negative value of maxsplit signifies all occurances.... | 457,013 |
def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory n... | defcompile_dir(dir,maxlevels=10,ddir=None,force=False,rx=None,quiet=False,legacy=False):"""Byte-compileallmodulesinthegivendirectorytree.Arguments(onlydirisrequired):dir:thedirectorytobyte-compilemaxlevels:maximumrecursionlevel(default10)ddir:ifgiven,purporteddirectoryname(thisisthedirectorynamethatwillshowupinerrormes... | 457,014 |
def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory n... | def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False): """Byte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: if given, purported directory n... | 457,015 |
def compile_file(fullname, ddir=None, force=0, rx=None, quiet=False, legacy=False): """Byte-compile file. fullname: the file to byte-compile ddir: if given, purported directory name (this is the directory name that will show up in error messages) force: if True, force compilation, even if timestamps are up-to... | defcompile_file(fullname,ddir=None,force=0,rx=None,quiet=False,legacy=False):"""Byte-compilefile.fullname:thefiletobyte-compileddir:ifgiven,purporteddirectoryname(thisisthedirectorynamethatwillshowupinerrormessages)force:ifTrue,forcecompilation,eveniftimestampsareup-to-datequiet:ifTrue,bequietduringcompilationlegacy:if... | 457,016 |
def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False, legacy=False): """Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default true) maxlevels: max recursion level (default 0) force: as for compile_dir() (default False) quiet: as for com... | defcompile_path(skip_curdir=1,maxlevels=0,force=False,quiet=False,legacy=False):"""Byte-compileallmoduleonsys.path.Arguments(alloptional):skip_curdir:iftrue,skipcurrentdirectory(defaulttrue)maxlevels:maxrecursionlevel(default0)force:asforcompile_dir()(defaultFalse)quiet:asforcompile_dir()(defaultFalse)legacy:asforcompi... | 457,017 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,018 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,019 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,020 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,021 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,022 |
def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | def main(): """Script main program.""" import argparse parser = argparse.ArgumentParser( description='Utilities to support installing Python libraries.') parser.add_argument('-l', action='store_const', default=10, const=0, dest='maxlevels', help="don't recurse down") parser.add_argument('-f', action='store_true', dest... | 457,023 |
def _f(a): print(a) return 1 | def _f(a): print(a) return 1 | 457,024 |
def bug708901(): for res in range(1, 10): pass | def bug708901(): for res in range(1, 10): pass | 457,025 |
def bug1333982(x=[]): assert 0, ([s for s in x] + 1) pass | def bug1333982(x=[]): assert 0, ([s for s in x] + 1) pass | 457,026 |
def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | 457,027 |
def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | 457,028 |
def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | def test_disassemble_str(self): self.do_disassembly_test(expr_str, dis_expr_str) self.do_disassembly_test(simple_stmt_str, dis_simple_stmt_str) self.do_disassembly_test(compound_stmt_str, dis_compound_stmt_str) | 457,029 |
def test_no_FatalError_infinite_loop(self): p = subprocess.Popen([sys.executable, "-c", 'import _testcapi;' '_testcapi.crash_no_current_thread()'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. self.assertEqual(err, b'Fatal... | def test_no_FatalError_infinite_loop(self): p = subprocess.Popen([sys.executable, "-c", 'import _testcapi;' '_testcapi.crash_no_current_thread()'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. self.assertEqual(err.rstrip()... | 457,030 |
def test_no_FatalError_infinite_loop(self): p = subprocess.Popen([sys.executable, "-c", 'import _testcapi;' '_testcapi.crash_no_current_thread()'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. self.assertEqual(err, b'Fatal... | def test_no_FatalError_infinite_loop(self): p = subprocess.Popen([sys.executable, "-c", 'import _testcapi;' '_testcapi.crash_no_current_thread()'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() self.assertEqual(out, b'') # This used to cause an infinite loop. self.assertEqual(err, b'Fatal... | 457,031 |
def handle_connect_event(self): self.connected = True self.handle_connect() | def handle_connect_event(self): self.connected = True self.handle_connect() | 457,032 |
def test_forkinthread(self): if sys.platform.startswith('win'): from test.test_support import TestSkipped raise TestSkipped("This test is only appropriate for " "POSIX-like systems.") def thread1(): try: pid = os.fork() # fork in a thread except RuntimeError: sys.exit(0) # exit the child | def test_forkinthread(self): def thread1(): try: pid = os.fork() # fork in a thread except RuntimeError: sys.exit(0) # exit the child | 457,033 |
def play_sound_file(self, data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg.args[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): raise unittest.SkipTest(msg) raise | def play_sound_file(self, data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg.args[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): raise unittest.SkipTest(msg) raise | 457,034 |
def test_ioctl_mutate(self): import array buf = array.array('i', [0]) ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) rpgrp = buf[0] self.assertEquals(r, 0) self.assertIn(rpgrp, ids) | def _check_ioctl_mutate_len(self, nbytes=None): buf = array.array('i') intsize = buf.itemsize ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) rpgrp = buf[0] self.assertEquals(r, 0) self.assertIn(rpgrp, ids) | 457,035 |
def test_ioctl_mutate(self): import array buf = array.array('i', [0]) ids = (os.getpgrp(), os.getsid(0)) tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) rpgrp = buf[0] self.assertEquals(r, 0) self.assertIn(rpgrp, ids) | def test_ioctl_mutate(self): import array buf = array.array('i', [0]) ids = (os.getpgrp(), os.getsid(0)) fill = -12345 if nbytes is not None: buf.extend([fill] * (nbytes // intsize)) self.assertEqual(len(buf) * intsize, nbytes) else: buf.append(fill) with open("/dev/tty", "r") as tty: r = fcntl.ioctl(tty, termios.TIO... | 457,036 |
def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | 457,037 |
def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii # format string. from _testcapi import format_unicode | 457,038 |
def parseliteral(): """ >>> element = ET.XML("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text</body></html> >>> element = ET.fromstring("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text... | def parseliteral(): """ >>> element = ET.XML("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text</body></html> >>> element = ET.fromstring("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text... | 457,039 |
def parseliteral(): """ >>> element = ET.XML("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text</body></html> >>> element = ET.fromstring("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text... | def parseliteral(): """ >>> element = ET.XML("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text</body></html> >>> element = ET.fromstring("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout, encoding='unicode') <html><body>text... | 457,040 |
def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): """An equality assertion for ordered sequences (like lists and tuples). | def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): """An equality assertion for ordered sequences (like lists and tuples). | 457,041 |
def setUp(self): try: os.mkdir(test_support.TESTFN) except OSError: pass for name in self.files: try: f = open(name, 'w') except UnicodeEncodeError: if not os.path.supports_unicode_filenames: raise unittest.SkipTest("test works only on NT+, and with " "pseudo-Unicode filesystems") f.write((name+'\n').encode("utf-8")) f... | def setUp(self): try: os.mkdir(test_support.TESTFN) except OSError: pass for name in self.files: try: f = open(name, 'w') except UnicodeEncodeError: if not os.path.supports_unicode_filenames: raise unittest.SkipTest("only NT+ and systems with Unicode" "-friendly filesystem encoding") f.write((name+'\n').encode("utf-8")... | 457,042 |
def test_stopasync(self): if _have_soundcard(): winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP ) time.sleep(0.5) try: winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ) except RuntimeError: pass else: # the first sound might already be fin... | def test_stopasync(self): if _have_soundcard(): winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP ) time.sleep(0.5) try: winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ) except RuntimeError: pass else: # the first sound might already be fin... | 457,043 |
def test_urandom(self): try: self.assertEqual(len(os.urandom(1)), 1) self.assertEqual(len(os.urandom(10)), 10) self.assertEqual(len(os.urandom(100)), 100) self.assertEqual(len(os.urandom(1000)), 1000) # see http://bugs.python.org/issue3708 self.assertEqual(len(os.urandom(0.9)), 0) self.assertEqual(len(os.urandom(1.1)),... | def test_urandom(self): try: self.assertEqual(len(os.urandom(1)), 1) self.assertEqual(len(os.urandom(10)), 10) self.assertEqual(len(os.urandom(100)), 100) self.assertEqual(len(os.urandom(1000)), 1000) # see http://bugs.python.org/issue3708 self.assertEqual(len(os.urandom(0.9)), 0) self.assertEqual(len(os.urandom(1.1)),... | 457,044 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,045 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,046 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,047 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,048 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,049 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,050 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,051 |
def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | def test_issue5604(self): # Test cannot cover imp.load_compiled function. # Martin von Loewis note what shared library cannot have non-ascii # character because init_xxx function cannot be compiled # and issue never happens for dynamic modules. # But sources modified to follow generic way for processing pathes. | 457,052 |
def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | 457,053 |
def __del__(self): pass | def __del__(self): pass | 457,054 |
def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | 457,055 |
def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | 457,056 |
def test_repeat(self): for b in b"abc", self.type2test(b"abc"): self.assertEqual(b * 3, b"abcabcabc") self.assertEqual(b * 0, b"") self.assertEqual(b * -1, b"") self.assertRaises(TypeError, lambda: b * 3.14) self.assertRaises(TypeError, lambda: 3.14 * b) # XXX Shouldn't bytes and bytearray agree on what to raise? self.... | def test_repeat(self): for b in b"abc", self.type2test(b"abc"): self.assertEqual(b * 3, b"abcabcabc") self.assertEqual(b * 0, b"") self.assertEqual(b * -1, b"") self.assertRaises(TypeError, lambda: b * 3.14) self.assertRaises(TypeError, lambda: 3.14 * b) # XXX Shouldn't bytes and bytearray agree on what to raise? self.... | 457,057 |
def deltree(dirname): # Don't hide legitimate errors: if one of these suckers exists, it's # an error if we can't remove it. if os.path.exists(dirname): # must pass unicode to os.listdir() so we get back unicode results. for fname in os.listdir(unicode(dirname)): os.unlink(os.path.join(dirname, fname)) os.rmdir(dirnam... | def deltree(dirname): # Don't hide legitimate errors: if one of these suckers exists, it's # an error if we can't remove it. if os.path.exists(dirname): # must pass unicode to os.listdir() so we get back unicode results. for fname in os.listdir(unicode(dirname)): os.unlink(os.path.join(dirname, fname)) os.rmdir(dirnam... | 457,058 |
def setUp(self): try: os.mkdir(test_support.TESTFN) except OSError: pass for name in self.files: try: f = open(name, 'w') except UnicodeEncodeError: if not os.path.supports_unicode_filenames: raise unittest.SkipTest("only NT+ and systems with Unicode" "-friendly filesystem encoding") f.write((name+'\n').encode("utf-8")... | def setUp(self): try: os.mkdir(test_support.TESTFN) except OSError: pass for name in self.files: try: f = open(name, 'w') except UnicodeEncodeError: if not os.path.supports_unicode_filenames: self.skipTest("only NT+ and systems with Unicode-friendly" "filesystem encoding") f.write((name+'\n').encode("utf-8")) f.close()... | 457,059 |
def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): try: fn(filename) raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: # the "filename" exception attribute may be encoded if isinstance(details.filename,... | def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): with self.assertRaises(expected_exception) as c: fn(filename) raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: # the "filename" exception attribute ma... | 457,060 |
def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): try: fn(filename) raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: # the "filename" exception attribute may be encoded if isinstance(details.filename,... | def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): try: fn(filename) raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: # the "filename" exception attribute may be encoded if isinstance(details.filename,... | 457,061 |
def test_listdir(self): f1 = os.listdir(test_support.TESTFN) f2 = os.listdir(unicode(test_support.TESTFN, sys.getfilesystemencoding())) sf2 = set(os.path.join(unicode(test_support.TESTFN), f) for f in f2) self.assertEqual(len(f1), len(self.files)) self.assertEqual(sf2, set(self.files)) | def test_listdir(self): f1 = os.listdir(test_support.TESTFN) f2 = os.listdir(unicode(test_support.TESTFN, sys.getfilesystemencoding())) sf2 = set(os.path.join(unicode(test_support.TESTFN), f) for f in f2) self.assertEqual(len(f1), len(self.files)) self.assertEqual(sf2, set(self.files)) | 457,062 |
def test_rename(self): for name in self.files: os.rename(name,"tmp") os.rename("tmp",name) | def test_rename(self): for name in self.files: os.rename(name,"tmp") os.rename("tmp",name) | 457,063 |
def test_directory(self): dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) os.chdir(dirname) f = open(filename, 'w') f.write((filename + '\n').encode("utf-8")) f.close() os.access(filename,os.R_OK) os.remove(filename... | def test_directory(self): dirname = os.path.join(test_support.TESTFN, u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) os.chdir(dirname) f = open(filename, 'w') f.write((filename + '\n').encode("utf-8")) f.close() os.access(filename,os.R_OK) os.remove(filenam... | 457,064 |
def test_directory(self): dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) os.chdir(dirname) f = open(filename, 'w') f.write((filename + '\n').encode("utf-8")) f.close() os.access(filename,os.R_OK) os.remove(filename... | def test_directory(self): dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) os.chdir(dirname) f = open(filename, 'w') f.write((filename + '\n').encode("utf-8")) f.close() os.access(filename,os.R_OK) os.remove(filename... | 457,065 |
def test_main(): try: test_support.run_unittest(UnicodeFileTests) finally: deltree(test_support.TESTFN) | def test_main(): try: test_support.run_unittest( UnicodeFileTests, UnicodeNFCFileTests, UnicodeNFDFileTests, UnicodeNFKCFileTests, UnicodeNFKDFileTests, ) finally: deltree(test_support.TESTFN) | 457,066 |
def test_main(): support.run_unittest(PosixTester) | def test_main(): support.run_unittest(PosixTester, PosixGroupsTester) | 457,067 |
def test_get_platform(self): | def test_get_platform(self): | 457,068 |
def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains # unescaped non-ASCII characters, which URIs should not. if string in (b'', ''): return b'' if isinstance(string, str): string = string.encode('utf-8') res = string... | def unquote_to_bytes(string): """unquote_to_bytes('abc%20def') -> b'abc def'.""" # Note: strings are encoded as UTF-8. This is only an issue if it contains # unescaped non-ASCII characters, which URIs should not. if not string: string.split return b'' if isinstance(string, str): string = string.encode('utf-8') res = s... | 457,069 |
def handle_accept(self) conn, addr = self.accept() print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM) channel = self.channel_class(self, conn, addr) | def handle_accept(self): conn, addr = self.accept() print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM) channel = self.channel_class(self, conn, addr) | 457,070 |
def http_error_401(self, req, fp, code, msg, headers): url = req.get_full_url() return self.http_error_auth_reqed('www-authenticate', url, req, headers) | def http_error_401(self, req, fp, code, msg, headers): url = req.get_full_url() return self.http_error_auth_reqed('www-authenticate', url, req, headers) | 457,071 |
def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib2 does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.get_host() return self.http_e... | def http_error_407(self, req, fp, code, msg, headers): # http_error_auth_reqed requires that there is no userinfo component in # authority. Assume there isn't one, since urllib2 does not (and # should not, RFC 3986 s. 3.2.1) support requests for URLs containing # userinfo. authority = req.get_host() response = self.ht... | 457,072 |
def test_large_PYTHONPATH(self): with test.support.EnvironmentVarGuard() as env: path1 = "ABCDE" * 100 path2 = "FGHIJ" * 100 env['PYTHONPATH'] = path1 + os.pathsep + path2 p = _spawn_python_with_env('-S', '-c', 'import sys; print(sys.path)') stdout, _ = p.communicate() self.assertIn(path1.encode('ascii'), stdout) self.... | def test_large_PYTHONPATH(self): with test.support.EnvironmentVarGuard() as env: path1 = "ABCDE" * 100 path2 = "FGHIJ" * 100 env['PYTHONPATH'] = path1 + os.pathsep + path2 code = """ import sys path = ":".join(sys.path) path = path.encode("ascii", "backslashreplace") sys.stdout.buffer.write(path)""" code = code.strip(... | 457,073 |
def test_copy(self): dup = self.set.copy() dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): self.failUnless(dup_list[i] is set_list[i]) | def test_copy(self): dup = self.set.copy() with test_support.check_warnings(): dup_list = sorted(dup) set_list = sorted(self.set) self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): self.failUnless(dup_list[i] is set_list[i]) | 457,074 |
def test_deep_copy(self): dup = copy.deepcopy(self.set) ##print type(dup), repr(dup) dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): self.assertEqual(dup_list[i], set_list[i]) | def test_deep_copy(self): dup = copy.deepcopy(self.set) ##print type(dup), repr(dup) with test_support.check_warnings(): dup_list = sorted(dup) set_list = sorted(self.set) self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): self.assertEqual(dup_list[i], set_list[i]) | 457,075 |
def test_constructor(self): for cons in (set, frozenset): for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): for g in (G, I, Ig, S, L, R): self.assertEqual(sorted(cons(g(s))), sorted(g(s))) self.assertRaises(TypeError, cons , X(s)) self.assertRaises(TypeError, cons , N(s)) self.assertRaises(ZeroDivisi... | def test_constructor(self): for cons in (set, frozenset): for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): with test_support.check_warnings(): for g in (G, I, Ig, S, L, R): self.assertEqual(sorted(cons(g(s))), sorted(g(s))) self.assertRaises(TypeError, cons , X(s)) self.assertRaises(TypeError, cons ... | 457,076 |
def test_inline_methods(self): s = set('november') for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): for meth in (s.union, s.intersection, s.difference, s.symmetric_difference, s.isdisjoint): for g in (G, I, Ig, L, R): expected = meth(data) actual = meth(G(data)) if isinstance(expected... | def test_inline_methods(self): s = set('november') for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): for meth in (s.union, s.intersection, s.difference, s.symmetric_difference, s.isdisjoint): for g in (G, I, Ig, L, R): expected = meth(data) actual = meth(G(data)) if isinstance(expected... | 457,077 |
def test_inplace_methods(self): for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): for methname in ('update', 'intersection_update', 'difference_update', 'symmetric_difference_update'): for g in (G, I, Ig, S, L, R): s = set('january') t = s.copy() getattr(s, methname)(list(g(data))) get... | def test_inplace_methods(self): for data in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5), 'december'): for methname in ('update', 'intersection_update', 'difference_update', 'symmetric_difference_update'): for g in (G, I, Ig, S, L, R): s = set('january') t = s.copy() getattr(s, methname)(list(g(data))) get... | 457,078 |
def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | 457,079 |
def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | 457,080 |
def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | 457,081 |
def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | 457,082 |
def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | def test_abs_paths(self): # Make sure all imported modules have their __file__ and __cached__ # attributes as absolute paths. Arranging to put the Lib directory on # PYTHONPATH would cause the os module to have a relative path for # __file__ if abs_paths() does not get run. sys and builtins (the # only other modules ... | 457,083 |
def test_lower(self): pass | def test_lower(self): pass | 457,084 |
def test_basic(self): self.assertTrue(issubclass(ByteArraySubclass, bytearray)) self.assertTrue(isinstance(ByteArraySubclass(), bytearray)) | def test_basic(self): self.assertTrue(issubclass(ByteArraySubclass, bytearray)) self.assertTrue(isinstance(ByteArraySubclass(), bytearray)) | 457,085 |
def test_basic(self): self.assertTrue(issubclass(ByteArraySubclass, bytearray)) self.assertTrue(isinstance(ByteArraySubclass(), bytearray)) | def test_basic(self): self.assertTrue(issubclass(ByteArraySubclass, bytearray)) self.assertTrue(isinstance(ByteArraySubclass(), bytearray)) | 457,086 |
def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = ByteArraySubclass(b"abcd") s2 = bytearray().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = self.subclass2test(b"abcd") s2 = self.type2test().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | 457,087 |
def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = ByteArraySubclass(b"abcd") s2 = bytearray().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = ByteArraySubclass(b"abcd") s2 = bytearray().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | 457,088 |
def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = ByteArraySubclass(b"abcd") s2 = bytearray().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | def test_join(self): # Make sure join returns a NEW object for single item sequences # involving a subclass. # Make sure that it is of the appropriate type. s1 = ByteArraySubclass(b"abcd") s2 = bytearray().join([s1]) self.assertTrue(s1 is not s2) self.assertTrue(type(s2) is bytearray, type(s2)) | 457,089 |
def test_pickle(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a... | def test_pickle(self): a = self.subclass2test(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(... | 457,090 |
def test_pickle(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a... | def test_pickle(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = self.subclass2test(b"efgh") for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(... | 457,091 |
def test_copy(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for copy_method in (copy.copy, copy.deepcopy): b = copy_method(a) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a), type(b)) self.assertEqu... | def test_copy(self): a = self.subclass2test(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for copy_method in (copy.copy, copy.deepcopy): b = copy_method(a) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a), type(b)) self.assertEq... | 457,092 |
def test_copy(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") for copy_method in (copy.copy, copy.deepcopy): b = copy_method(a) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a), type(b)) self.assertEqu... | def test_copy(self): a = ByteArraySubclass(b"abcd") a.x = 10 a.y = self.subclass2test(b"efgh") for copy_method in (copy.copy, copy.deepcopy): b = copy_method(a) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) self.assertEqual(a.x, b.x) self.assertEqual(a.y, b.y) self.assertEqual(type(a), type(b)) self.assertEq... | 457,093 |
def __init__(self, newarg=1, *args, **kwargs): bytearray.__init__(self, *args, **kwargs) | def __init__(self, newarg=1, *args, **kwargs): bytearray.__init__(self, *args, **kwargs) | 457,094 |
def test_main(): test.support.run_unittest( BytesTest, AssortedBytesTest, BytesAsStringTest, ByteArrayTest, ByteArrayAsStringTest, ByteArraySubclassTest, BytearrayPEP3137Test) | def test_main(): test.support.run_unittest( BytesTest, AssortedBytesTest, BytesAsStringTest, ByteArrayTest, ByteArrayAsStringTest, BytesSubclassTest, ByteArraySubclassTest, BytearrayPEP3137Test) | 457,095 |
def setUp(self): self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0) self.my_py_filename = fix_ext_py(__file__) self.maxDiff = None | def setUp(self): self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0) self.my_py_filename = fix_ext_py(__file__) self.maxDiff = None | 457,096 |
def test_concat(self): s1 = 'x' * MAX_Py_ssize_t self.assertRaises(OverflowError, operator.add, s1, '?') | def test_concat(self): s1 = 'x' * MAX_Py_ssize_t self.assertRaises(OverflowError, operator.add, s1, '?') | 457,097 |
def test_optimized_concat(self): x = 'x' * MAX_Py_ssize_t try: x = x + '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should have raised OverflowError") try: x += '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should ... | def test_optimized_concat(self): x = 'x' * MAX_Py_ssize_t try: x = x + '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should have raised OverflowError") try: x += '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should ... | 457,098 |
def test_optimized_concat(self): x = 'x' * MAX_Py_ssize_t try: x = x + '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should have raised OverflowError") try: x += '?' # this statement uses a fast path in ceval.c except OverflowError: pass else: self.fail("should ... | def test_optimized_concat(self): x = 'x' * MAX_Py_ssize_t try: x = x + '?'with self.assertRaises(OverflowError) as cm: x = x + b"x" * 128 with self.assertRaises(OverflowError) as cm: x += b"x" * 128 @bigaddrspacetest def test_repeat(self): x = b"x" * (MAX_Py_ssize_t - 128) self.assertRaises(OverflowError, operator... | 457,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.