<commit_before>import pydle
from .fixtures import with_client


@with_client()
def test_client_same_channel(server, client):
    assert client.is_same_channel('#lobby', '#lobby')
    assert not client.is_same_channel('#lobby', '#support')
    assert not client.is_same_channel('#lobby', 'jilles')

@with_client()
def test_channel_creation(server, client):
    client._create_channel('#pydle')
    assert '#pydle' in client.channels
    assert client.channels['#pydle']['users'] == set()

@with_client()
def test_channel_destruction(server, client):
    client._create_channel('#pydle')
    client._destroy_channel('#pydle')
    assert '#pydle' not in client.channels

@with_client()
def test_channel_user_destruction(server, client):
    client._create_channel('#pydle')
    client._create_user('WiZ')
    client.channels['#pydle']['users'].add('WiZ')

    client._destroy_channel('#pydle')
    assert '#pydle' not in client.channels
    assert 'WiZ' not in client.users
<commit_msg>tests: Add is_channel/in_channel tests.<commit_after>import pydle
from .fixtures import with_client


@with_client()
def test_client_same_channel(server, client):
    assert client.is_same_channel('#lobby', '#lobby')
    assert not client.is_same_channel('#lobby', '#support')
    assert not client.is_same_channel('#lobby', 'jilles')

@with_client()
def test_client_in_channel(server, client):
    client._create_channel('#lobby')
    assert client.in_channel('#lobby')

@with_client()
def test_client_is_channel(server, client):
    # Test always true...
    assert client.is_channel('#lobby')
    assert client.is_channel('WiZ')
    assert client.is_channel('irc.fbi.gov')

@with_client()
def test_channel_creation(server, client):
    client._create_channel('#pydle')
    assert '#pydle' in client.channels
    assert client.channels['#pydle']['users'] == set()

@with_client()
def test_channel_destruction(server, client):
    client._create_channel('#pydle')
    client._destroy_channel('#pydle')
    assert '#pydle' not in client.channels

@with_client()
def test_channel_user_destruction(server, client):
    client._create_channel('#pydle')
    client._create_user('WiZ')
    client.channels['#pydle']['users'].add('WiZ')

    client._destroy_channel('#pydle')
    assert '#pydle' not in client.channels
    assert 'WiZ' not in client.users

{'fraction_non_alphanumeric': 0.14187741105872267, 'fraction_numerical': 0.0, 'mean_word_length': 5.574647887323944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1659315', 'n_tokens_mistral': 767, 'n_tokens_neox': 737, 'n_words': 147}