コード例 #1
0
  def testEncodingFails(self):
    eventLog = []

    try:
      encoding = xmlEncoding.detect(self.bytes, eventLog)
    except UnicodeError,u:
      self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")
コード例 #2
0
  def testEncodingFails(self):
    eventLog = []

    try:
      encoding = xmlEncoding.detect(self.bytes, eventLog)
    except UnicodeError,u:
      self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")
コード例 #3
0
  def testEncodingFails(self):
    eventLog = []
    r = open(self.filename, 'r').read(256)

    try:
      encoding = xmlEncoding.detect(r, eventLog)
    except UnicodeError,u:
      self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")
コード例 #4
0
  def testEncodingMatches(self):
    try:
      enc = xmlEncoding.detect(self.bytes)
    except UnicodeError as u:
      self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")

    self.assert_(enc, 'An encoding must be returned for all valid files ('
        + self.filename + ')')
    self.assertEqual(enc, self.expectedEncoding, 'Encoding for '
        + self.filename + ' should be ' + self.expectedEncoding + ', but was ' + enc)
コード例 #5
0
  def testEncodingFails(self):
    eventLog = []

    try:
      encoding = xmlEncoding.detect(self.bytes, eventLog)
    except UnicodeError as u:
      self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")

    if encoding:
      self.fail("'" + self.filename + "' should not parse successfully (as " + encoding + ")")

    if not(eventLog):
      self.fail("'" + self.filename + "' should give a reason for parse failure")
コード例 #6
0
    def testEncodingMatches(self):
        try:
            enc = xmlEncoding.detect(self.bytes)
        except UnicodeError as u:
            self.fail("'" + self.filename +
                      "' should not cause an exception (" + str(u) + ")")

        self.assert_(
            enc, 'An encoding must be returned for all valid files (' +
            self.filename + ')')
        self.assertEqual(
            enc, self.expectedEncoding, 'Encoding for ' + self.filename +
            ' should be ' + self.expectedEncoding + ', but was ' + enc)
コード例 #7
0
    def testEncodingFails(self):
        eventLog = []

        try:
            encoding = xmlEncoding.detect(self.bytes, eventLog)
        except UnicodeError as u:
            self.fail("'" + self.filename +
                      "' should not cause an exception (" + str(u) + ")")

        if encoding:
            self.fail("'" + self.filename +
                      "' should not parse successfully (as " + encoding + ")")

        if not (eventLog):
            self.fail("'" + self.filename +
                      "' should give a reason for parse failure")
コード例 #8
0
ファイル: testXmlEncoding.py プロジェクト: melody40/monorepo
 def testEncodingMatches(self):
     try:
         enc = xmlEncoding.detect(self.bytes)
     except UnicodeError, u:
         self.fail("'" + self.filename +
                   "' should not cause an exception (" + str(u) + ")")
コード例 #9
0
 def testEncodingMatches(self):
   try:
     enc = xmlEncoding.detect(self.bytes)
   except UnicodeError,u:
     self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")
コード例 #10
0
 def testEncodingMatches(self):
   r = open(self.filename, 'r').read(256)
   try:
     enc = xmlEncoding.detect(r)
   except UnicodeError,u:
     self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")