Exemplo n.º 1
0
  def test_canonify(self):
    result = ncf_rudder.canonify("ascii @&_ string")
    self.assertEquals(result, "ascii_____string")

    # python/ncf reads UTF-8 files and produces u'' strings in python2 and '' strings in python3
    # python2 tests
    if sys.version_info[0] == 2:
      # unicode in source file -> interpreted as unicode with u'' -> correct iso in python string (ncf builder use case)
      result = ncf_rudder.canonify(u'héhé')
      self.assertEquals(result, 'h__h__')

    # python3 tests
    if sys.version_info[0] == 3:
      # unicode in source file -> correct unicode in python string (ncf builder use case)
      result = ncf_rudder.canonify('héhé')
      self.assertEquals(result, "h__h__")
Exemplo n.º 2
0
    def test_canonify(self):
        result = ncf_rudder.canonify("ascii @&_ string")
        self.assertEquals(result, "ascii_____string")

        # python/ncf reads UTF-8 files and produces u'' strings in python2 and '' strings in python3
        # python2 tests
        if sys.version_info[0] == 2:
            # unicode in source file -> interpreted as unicode with u'' -> correct iso in python string (ncf builder use case)
            result = ncf_rudder.canonify(u'héhé')
            self.assertEquals(result, 'h__h__')

        # python3 tests
        if sys.version_info[0] == 3:
            # unicode in source file -> correct unicode in python string (ncf builder use case)
            result = ncf_rudder.canonify('héhé')
            self.assertEquals(result, "h__h__")