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) + ")")
  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) + ")")
  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) + ")")
  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)
  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")
Beispiel #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)
Beispiel #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")
Beispiel #8
0
 def testEncodingMatches(self):
     try:
         enc = xmlEncoding.detect(self.bytes)
     except UnicodeError, u:
         self.fail("'" + self.filename +
                   "' should not cause an exception (" + str(u) + ")")
 def testEncodingMatches(self):
   try:
     enc = xmlEncoding.detect(self.bytes)
   except UnicodeError,u:
     self.fail("'" + self.filename + "' should not cause an exception (" + str(u) + ")")
 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) + ")")