File: test_ansi.py

package info (click to toggle)
python-colorful 0.5.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,124 kB
  • sloc: python: 1,343; sh: 8; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 602 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
# -*- coding: utf-8 -*-

"""
    colorful
    ~~~~~~~~

    Terminal string styling done right, in Python.

    :copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>
    :license: MIT, see LICENSE for more details.
"""

import os

import pytest

# do not overwrite module
os.environ['COLORFUL_NO_MODULE_OVERWRITE'] = '1'

import colorful.ansi as ansi  # noqa


@pytest.mark.parametrize('r, g, b, result', [
    (118, 118, 118, 243),
])
def test_rgb_to_ansi256(r, g, b, result):
    """
    Test converting an RGB value to an ANSI 256 color.
    """

    assert result == ansi.rgb_to_ansi256(r, g, b)