예제 #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')
예제 #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')
예제 #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")
예제 #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: é')
예제 #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: é')
예제 #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: é")
예제 #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: é')
예제 #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: é')