Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 22, 2024
1 parent e4b18ca commit ebb9bde
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions bioframe/io/bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
We also don't enforce limiting name fields to 7-bit printable ascii.
"""
from __future__ import annotations
from typing import Callable, Optional

import pathlib
import re
import warnings
from typing import Callable, Optional

import pandas as pd
import numpy as np

import pandas as pd

__all__ = ["to_bed"]

Expand Down
24 changes: 12 additions & 12 deletions tests/test_bed.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np
import os
import tempfile

import pandas as pd
import pytest
import tempfile

import bioframe

Expand All @@ -20,7 +20,7 @@ def test_involution():

def test_chrom_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'chrom'] = 'value with space'
with pytest.raises(ValueError):
bioframe.to_bed(bf, os.path.join(directory, 'foo.bed'))
Expand All @@ -36,7 +36,7 @@ def test_chrom_validators():

def test_end_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'end'] = 10 # end must be after start
bf.loc[0, 'start'] = 11
with pytest.raises(ValueError):
Expand All @@ -45,7 +45,7 @@ def test_end_validators():

def test_name_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'name'] = '' # must not be empty
with pytest.raises(ValueError):
bioframe.to_bed(bf, os.path.join(directory, 'foo.bed'))
Expand All @@ -57,7 +57,7 @@ def test_name_validators():

def test_score_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
# negative value is enforced by the normal types

bf.loc[0, 'score'] = 1001
Expand All @@ -71,7 +71,7 @@ def test_score_validators():

def test_strand_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'strand'] = '*'
with pytest.raises(ValueError):
bioframe.to_bed(bf, os.path.join(directory, 'foo.bed'))
Expand All @@ -80,7 +80,7 @@ def test_strand_validators():
def test_thick_validators():
with tempfile.TemporaryDirectory() as directory:
for direction in ['Start', 'End']:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'start'] = 100
bf.loc[0, 'end'] = 1000
bf.loc[0, f'thick{direction}'] = 1001
Expand All @@ -94,7 +94,7 @@ def test_thick_validators():

def test_itemRgb_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf["itemRgb"] = bf["itemRgb"].astype(str)
bf.loc[0, 'itemRgb'] = 'a,12,13' # must be integers
with pytest.raises(ValueError):
Expand All @@ -119,15 +119,15 @@ def test_itemRgb_validators():

def test_blockCount_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'blockCount'] = 0
with pytest.raises(ValueError):
bioframe.to_bed(bf, os.path.join(directory, 'foo.bed'))


def test_blockSizes_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'blockCount'] = 2
bf.loc[0, 'blockSizes'] = '2,a,'
with pytest.raises(ValueError):
Expand All @@ -141,7 +141,7 @@ def test_blockSizes_validators():

def test_blockStarts_validators():
with tempfile.TemporaryDirectory() as directory:
bf = bioframe.read_table(f'tests/test_data/bed12.bed', schema='bed12')
bf = bioframe.read_table('tests/test_data/bed12.bed', schema='bed12')
bf.loc[0, 'blockCount'] = 2
bf.loc[0, 'blockSizes'] = '2,4,'
bf.loc[0, 'blockStarts'] = '0,a,'
Expand Down

0 comments on commit ebb9bde

Please sign in to comment.