<commit_before>import errno
import os
import signal

import pytest

import signalfd

def test_block_and_read():
    fd = signalfd.signalfd(-1, [signal.SIGUSR1], signalfd.SFD_CLOEXEC)
    try:
        signalfd.sigprocmask(signalfd.SIG_BLOCK, [signal.SIGUSR1])
        os.kill(os.getpid(), signal.SIGUSR1)
        si = signalfd.read_siginfo(fd)
        assert si.ssi_signo == signal.SIGUSR1
    finally:
        os.close(fd)


def test_read_fd_no_data():
    fd = signalfd.signalfd(-1, [signal.SIGUSR1], signalfd.SFD_CLOEXEC | signalfd.SFD_NONBLOCK )
    try:
        err = pytest.raises((OSError, IOError), signalfd.read_siginfo, fd)
        assert err.value.errno == errno.EAGAIN
    finally:
        os.close(fd)

<commit_msg>Spacing.<commit_after>import errno
import os
import signal

import pytest

import signalfd


def test_block_and_read():
    fd = signalfd.signalfd(-1, [signal.SIGUSR1], signalfd.SFD_CLOEXEC)
    try:
        signalfd.sigprocmask(signalfd.SIG_BLOCK, [signal.SIGUSR1])
        os.kill(os.getpid(), signal.SIGUSR1)
        si = signalfd.read_siginfo(fd)
        assert si.ssi_signo == signal.SIGUSR1
    finally:
        os.close(fd)


def test_read_fd_no_data():
    fd = signalfd.signalfd(-1, [signal.SIGUSR1], signalfd.SFD_CLOEXEC | signalfd.SFD_NONBLOCK )
    try:
        err = pytest.raises((OSError, IOError), signalfd.read_siginfo, fd)
        assert err.value.errno == errno.EAGAIN
    finally:
        os.close(fd)


{'fraction_non_alphanumeric': 0.11379310344827587, 'fraction_numerical': 0.009655172413793104, 'mean_word_length': 3.157593123209169, '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': '1423132', 'n_tokens_mistral': 567, 'n_tokens_neox': 566, 'n_words': 92}