Example #1
0
 def enable():
     """Enable wild pokemon spawning and chatter in channel"""
     if nick == chan:
         return "Use in a channel"
     elif not chan in enabledChans:
         enabledChans.append(chan)
         return colors.get_color('green')+"Texemon enabled in {}".format(chan)
     else:
         return colors.get_color('yellow')+"Texemon already enabled in {}".format(chan)
Example #2
0
 def disable():
     """Disable wild pokemon spawning and chatter in channel"""
     if nick == chan:
         return "Use in a channel"
     elif chan in enabledChans:
         enabledChans.remove(chan)
         return colors.get_color('red')+"Texemon disabled in {}".format(chan)
     else:
         return colors.get_color('green')+"Texemon is not enabled, nothing to disable in {}".format(chan)
Example #3
0
def test_get_random_color():
    assert get_color("random") in ["\x03" + i for i in IRC_COLOUR_DICT.values()]
    assert get_color("random", return_formatted=False) in list(IRC_COLOUR_DICT.values())

    with mock.patch(
            'cloudbot.util.colors.randint',
            return_value=4  # chosen by fair dice roll, guranteed to be random.
    ):
        assert get_color('random') == '\x0304'
Example #4
0
def test_get_random_color():
    assert get_color("random") in ["\x03" + i for i in IRC_COLOUR_DICT.values()]
    assert get_color("random", return_formatted=False) in list(IRC_COLOUR_DICT.values())
Example #5
0
def test_get_color():
    assert get_color("red") == "\x0304"
    assert get_color("red", return_formatted=False) == "04"
Example #6
0
def test_invalid_color():
    with pytest.raises(KeyError) as excinfo:
        get_color("cake")
    assert 'not in the list of available colours' in str(excinfo.value)
Example #7
0
def test_get_color():
    assert get_color("red") == "\x0304"
    assert get_color("red", return_formatted=False) == "04"
Example #8
0
def test_invalid_color():
    with pytest.raises(KeyError) as excinfo:
        get_color("cake")
    assert 'not in the list of available colours' in str(excinfo.value)
Example #9
0
def test_get_random_color():
    assert get_color("random") in [
        "\x03" + i for i in IRC_COLOUR_DICT.values()
    ]
    assert get_color("random",
                     return_formatted=False) in list(IRC_COLOUR_DICT.values())