Python test.test_support.TESTFN_UNICODE Examples
The following are 23
code examples of test.test_support.TESTFN_UNICODE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.test_support
, or try the search function
.
Example #1
Source File: test_sax.py From oss-ftp with MIT License | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #2
Source File: test_sax.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #3
Source File: test_sax.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #4
Source File: test_sax.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #5
Source File: test_sax.py From BinderFilter with MIT License | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #6
Source File: test_posix.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_path_with_null_unicode(self): fn = test_support.TESTFN_UNICODE try: fn.encode(test_support.TESTFN_ENCODING) except (UnicodeError, TypeError): self.skipTest("Requires unicode filenames support") fn_with_NUL = fn + u'\0' self.addCleanup(test_support.unlink, fn) test_support.unlink(fn) fd = None try: with self.assertRaises(TypeError): fd = os.open(fn_with_NUL, os.O_WRONLY | os.O_CREAT) # raises finally: if fd is not None: os.close(fd) self.assertFalse(os.path.exists(fn)) self.assertRaises(TypeError, os.mkdir, fn_with_NUL) self.assertFalse(os.path.exists(fn)) open(fn, 'wb').close() self.assertRaises(TypeError, os.stat, fn_with_NUL)
Example #7
Source File: test_sax.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_expat_locator_withinfo_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) result = StringIO() xmlgen = XMLGenerator(result) parser = create_parser() parser.setContentHandler(xmlgen) parser.parse(fname) self.assertEqual(parser.getSystemId(), fname) self.assertEqual(parser.getPublicId(), None) # =========================================================================== # # error reporting # # ===========================================================================
Example #8
Source File: test_sax.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)
Example #9
Source File: test_sax.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)
Example #10
Source File: test_sax.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #11
Source File: test_gzip.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_unicode_filename(self): unicode_filename = test_support.TESTFN_UNICODE try: unicode_filename.encode(test_support.TESTFN_ENCODING) except (UnicodeError, TypeError): self.skipTest("Requires unicode filenames support") self.filename = unicode_filename with gzip.GzipFile(unicode_filename, "wb") as f: f.write(data1 * 50) with gzip.GzipFile(unicode_filename, "rb") as f: self.assertEqual(f.read(), data1 * 50) # Sanity check that we are actually operating on the right file. with open(unicode_filename, 'rb') as fobj, \ gzip.GzipFile(fileobj=fobj, mode="rb") as f: self.assertEqual(f.read(), data1 * 50)
Example #12
Source File: test_sax.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #13
Source File: test_sax.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)
Example #14
Source File: test_sax.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #15
Source File: test_gzip.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_unicode_filename(self): unicode_filename = test_support.TESTFN_UNICODE try: unicode_filename.encode(test_support.TESTFN_ENCODING) except (UnicodeError, TypeError): self.skipTest("Requires unicode filenames support") self.filename = unicode_filename with gzip.GzipFile(unicode_filename, "wb") as f: f.write(data1 * 50) with gzip.GzipFile(unicode_filename, "rb") as f: self.assertEqual(f.read(), data1 * 50) # Sanity check that we are actually operating on the right file. with open(unicode_filename, 'rb') as fobj, \ gzip.GzipFile(fileobj=fobj, mode="rb") as f: self.assertEqual(f.read(), data1 * 50)
Example #16
Source File: test_sax.py From BinderFilter with MIT License | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #17
Source File: test_sax.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)
Example #18
Source File: test_sax.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #19
Source File: test_gzip.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_unicode_filename(self): unicode_filename = test_support.TESTFN_UNICODE try: unicode_filename.encode(test_support.TESTFN_ENCODING) except (UnicodeError, TypeError): self.skipTest("Requires unicode filenames support") self.filename = unicode_filename with gzip.GzipFile(unicode_filename, "wb") as f: f.write(data1 * 50) with gzip.GzipFile(unicode_filename, "rb") as f: self.assertEqual(f.read(), data1 * 50) # Sanity check that we are actually operating on the right file. with open(unicode_filename, 'rb') as fobj, \ gzip.GzipFile(fileobj=fobj, mode="rb") as f: self.assertEqual(f.read(), data1 * 50)
Example #20
Source File: test_sax.py From oss-ftp with MIT License | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)
Example #21
Source File: test_sax.py From oss-ftp with MIT License | 5 votes |
def test_expat_file_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(open(fname)) self.assertEqual(result.getvalue(), xml_test_out) # ===== DTDHandler support
Example #22
Source File: test_gzip.py From oss-ftp with MIT License | 5 votes |
def test_unicode_filename(self): unicode_filename = test_support.TESTFN_UNICODE try: unicode_filename.encode(test_support.TESTFN_ENCODING) except (UnicodeError, TypeError): self.skipTest("Requires unicode filenames support") with gzip.GzipFile(unicode_filename, "wb") as f: f.write(data1 * 50) with gzip.GzipFile(unicode_filename, "rb") as f: self.assertEqual(f.read(), data1 * 50) # Sanity check that we are actually operating on the right file. with open(unicode_filename, 'rb') as fobj, \ gzip.GzipFile(fileobj=fobj, mode="rb") as f: self.assertEqual(f.read(), data1 * 50)
Example #23
Source File: test_sax.py From BinderFilter with MIT License | 5 votes |
def test_expat_inpsource_sysid_unicode(self): fname = support.TESTFN_UNICODE shutil.copyfile(TEST_XMLFILE, fname) self.addCleanup(support.unlink, fname) parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(InputSource(fname)) self.assertEqual(result.getvalue(), xml_test_out)