def test_read(self): """ Test read(). """ loader = Loader() path = self._get_path('ascii.mustache') actual = loader.read(path) self.assertString(actual, 'ascii: abc')
def test_read(self): """ Test read(). """ reader = Loader() path = self._get_path("ascii.mustache") actual = reader.read(path) self.assertString(actual, u"ascii: abc")
def test_read__encoding__argument(self): """ Test read(): encoding argument respected. """ loader = Loader() path = self._get_path('non_ascii.mustache') self.assertRaises(UnicodeDecodeError, loader.read, path) actual = loader.read(path, encoding='utf-8') self.assertString(actual, 'non-ascii: é')
def test_read__encoding__argument(self): """ Test read(): encoding argument respected. """ reader = Loader() path = self._get_path("non_ascii.mustache") self.assertRaises(UnicodeDecodeError, reader.read, path) actual = reader.read(path, encoding="utf-8") self.assertString(actual, u"non-ascii: é")
def test_read__file_encoding__attribute(self): """ Test read(): file_encoding attribute respected. """ loader = Loader() path = self._get_path('non_ascii.mustache') self.assertRaises(UnicodeDecodeError, loader.read, path) loader.file_encoding = 'utf-8' actual = loader.read(path) self.assertString(actual, 'non-ascii: é')