Python pandas.io.formats.excel.CSSToExcelConverter() Examples

The following are 23 code examples of pandas.io.formats.excel.CSSToExcelConverter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.io.formats.excel , or try the search function .
Example #1
Source File: test_to_excel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
Example #2
Source File: test_to_excel.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with catch_warnings(record=True):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #3
Source File: test_to_excel.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
Example #4
Source File: test_to_excel.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
Example #5
Source File: test_to_excel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with tm.assert_produces_warning(CSSWarning):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #6
Source File: test_to_excel.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with catch_warnings(record=True):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #7
Source File: test_to_excel.py    From recruit with Apache License 2.0 6 votes vote down vote up
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with tm.assert_produces_warning(CSSWarning):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #8
Source File: test_to_excel.py    From recruit with Apache License 2.0 6 votes vote down vote up
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
Example #9
Source File: test_to_excel.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
Example #10
Source File: test_to_excel.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
Example #11
Source File: test_to_excel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
Example #12
Source File: test_to_excel.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
Example #13
Source File: test_to_excel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css) 
Example #14
Source File: test_to_excel.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel_good_colors(input_color, output_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    expected["fill"] = {
        "patternType": "solid",
        "fgColor": output_color
    }

    expected["font"] = {
        "color": output_color
    }

    expected["border"] = {
        k: {
            "color": output_color,
        } for k in ("top", "right", "bottom", "left")
    }

    with tm.assert_produces_warning(None):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #15
Source File: test_to_excel.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_css_to_excel_good_colors(input_color, output_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    expected["fill"] = {
        "patternType": "solid",
        "fgColor": output_color
    }

    expected["font"] = {
        "color": output_color
    }

    expected["border"] = {
        k: {
            "color": output_color,
        } for k in ("top", "right", "bottom", "left")
    }

    with tm.assert_produces_warning(None):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #16
Source File: test_to_excel.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
Example #17
Source File: test_to_excel.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel_good_colors(input_color, output_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    expected["fill"] = {
        "patternType": "solid",
        "fgColor": output_color
    }

    expected["font"] = {
        "color": output_color
    }

    expected["border"] = {
        k: {
            "color": output_color,
        } for k in ("top", "right", "bottom", "left")
    }

    with tm.assert_produces_warning(None):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #18
Source File: test_to_excel.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css) 
Example #19
Source File: test_to_excel.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
Example #20
Source File: test_to_excel.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css) 
Example #21
Source File: test_to_excel.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css) 
Example #22
Source File: test_to_excel.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_css_to_excel_good_colors(input_color, output_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    expected["fill"] = {
        "patternType": "solid",
        "fgColor": output_color
    }

    expected["font"] = {
        "color": output_color
    }

    expected["border"] = {
        k: {
            "color": output_color,
        } for k in ("top", "right", "bottom", "left")
    }

    with tm.assert_produces_warning(None):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
Example #23
Source File: test_to_excel.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css)