Exemplo n.º 1
0
    def test_read(self):
        """
        Test read().

        """
        loader = Loader()
        path = self._get_path('ascii.mustache')
        actual = loader.read(path)
        self.assertString(actual, 'ascii: abc')
Exemplo n.º 2
0
    def test_read(self):
        """
        Test read().

        """
        loader = Loader()
        path = self._get_path('ascii.mustache')
        actual = loader.read(path)
        self.assertString(actual, 'ascii: abc')
Exemplo n.º 3
0
    def test_read(self):
        """
        Test read().

        """
        reader = Loader()
        path = self._get_path("ascii.mustache")
        actual = reader.read(path)
        self.assertString(actual, u"ascii: abc")
Exemplo n.º 4
0
    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: é')
Exemplo n.º 5
0
    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: é')
Exemplo n.º 6
0
    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: é")
Exemplo n.º 7
0
    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: é')
Exemplo n.º 8
0
    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: é')