# Path: cardinal/util.py
# def is_action(message):
# def parse_action(nick, message):
# def sleep(secs):
# def strip_formatting(line):
#         def white(text):
#         def black(text):
#         def blue(text):
#         def green(text):
#         def light_red(text):
#         def brown(text):
#         def purple(text):
#         def orange(text):
#         def yellow(text):
#         def light_green(text):
#         def cyan(text):
#         def light_cyan(text):
#         def light_blue(text):
#         def pink(text):
#         def grey(text):
#         def light_grey(text):
#     def bold(text):
#     def monospace(text):
#     def italic(text):
#     def strikethrough(text):
#     def underline(text):
# class formatting:
#     class color:
#     C = color
# F = formatting


import datetime
import pytest
from twisted.internet import defer
from cardinal import util
    ('ACTION tests', False),
))
def test_is_action(message, expected):
    assert util.is_action(message) == expected


@pytest.mark.parametrize('nick,message,expected', (
    ('Cardinal', '\x01ACTION tests\x01', '* Cardinal tests'),
    ('Cardinal', '\x01ACTION tests', '* Cardinal tests'),
    ('Cardinal', '\x01ACTION \x01', '* Cardinal'),
    ('Cardinal', '\x01ACTION ', '* Cardinal'),
    ('Cardinal', '\x01ACTION\x01', '* Cardinal'),
    ('Cardinal', '\x01ACTION', '* Cardinal'),
))
def test_parse_action(nick, message, expected):
    assert util.parse_action(nick, message) == expected


def test_parse_action_raises():
    with pytest.raises(ValueError):
        util.parse_action('Cardinal', 'this is not an action!')


@pytest.mark.parametrize("input_,expected", (
    ('\x02bold\x02', 'bold'),
    ('\x0309colored\x03', 'colored'),
    # a naive implementation may return 45
    ('\x03\x033,012345', '2345'),
))
def test_strip_formatting(input_, expected):

# Path: cardinal/util.py
# def is_action(message):
# def parse_action(nick, message):
# def sleep(secs):
# def strip_formatting(line):
#         def white(text):
#         def black(text):
#         def blue(text):
#         def green(text):
#         def light_red(text):
#         def brown(text):
#         def purple(text):
#         def orange(text):
#         def yellow(text):
#         def light_green(text):
#         def cyan(text):
#         def light_cyan(text):
#         def light_blue(text):
#         def pink(text):
#         def grey(text):
#         def light_grey(text):
#     def bold(text):
#     def monospace(text):
#     def italic(text):
#     def strikethrough(text):
#     def underline(text):
# class formatting:
#     class color:
#     C = color
# F = formatting


# Path: cardinal/test_util.py
import datetime
import pytest
from twisted.internet import defer
from cardinal import util

    ('ACTION tests', False),
))
def test_is_action(message, expected):
    assert util.is_action(message) == expected


@pytest.mark.parametrize('nick,message,expected', (
    ('Cardinal', '\x01ACTION tests\x01', '* Cardinal tests'),
    ('Cardinal', '\x01ACTION tests', '* Cardinal tests'),
    ('Cardinal', '\x01ACTION \x01', '* Cardinal'),
    ('Cardinal', '\x01ACTION ', '* Cardinal'),
    ('Cardinal', '\x01ACTION\x01', '* Cardinal'),
    ('Cardinal', '\x01ACTION', '* Cardinal'),
))
def test_parse_action(nick, message, expected):
    assert util.parse_action(nick, message) == expected


def test_parse_action_raises():
    with pytest.raises(ValueError):
        util.parse_action('Cardinal', 'this is not an action!')


@pytest.mark.parametrize("input_,expected", (
    ('\x02bold\x02', 'bold'),
    ('\x0309colored\x03', 'colored'),
    # a naive implementation may return 45
    ('\x03\x033,012345', '2345'),
))
def test_strip_formatting(input_, expected):

    assert util.strip_formatting(input_) == expected