File: test_csshtmlheader.py

package info (click to toggle)
nbconvert 7.16.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,044 kB
  • sloc: python: 8,394; makefile: 199; javascript: 2
file content (45 lines) | stat: -rw-r--r-- 1,599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
Module with tests for the csshtmlheader preprocessor
"""

# -----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------

from nbconvert.preprocessors.csshtmlheader import CSSHTMLHeaderPreprocessor

from .base import PreprocessorTestsBase

# -----------------------------------------------------------------------------
# Class
# -----------------------------------------------------------------------------


class TestCSSHTMLHeader(PreprocessorTestsBase):
    """Contains test functions for csshtmlheader.py"""

    def build_preprocessor(self):
        """Make an instance of a preprocessor"""
        preprocessor = CSSHTMLHeaderPreprocessor()
        preprocessor.enabled = True
        return preprocessor

    def test_constructor(self):
        """Can a CSSHTMLHeaderPreprocessor be constructed?"""
        self.build_preprocessor()

    def test_output(self):
        """Test the output of the CSSHTMLHeaderPreprocessor"""
        nb = self.build_notebook()
        res = self.build_resources()
        preprocessor = self.build_preprocessor()
        nb, res = preprocessor(nb, res)
        assert "css" in res["inlining"]