Ejemplo n.º 1
0
def test_bedrecord__accessors__3_fields():
    record = BEDRecord("my_contig\t12\t345")

    assert record.contig == "my_contig"
    assert record.start == 12
    assert record.end == 345
    with pytest.raises(IndexError):
        record.name()
    with pytest.raises(IndexError):
        record.score()
    with pytest.raises(IndexError):
        record.strand()
Ejemplo n.º 2
0
def test_bedrecord__setters__type_errors():
    record = BEDRecord("my_contig\t12\t345\tname\t0\t+")

    with pytest.raises(ValueError):
        record.contig = 17
    with pytest.raises(ValueError):
        record.start = "foo"
    with pytest.raises(ValueError):
        record.end = "foo"
    with pytest.raises(ValueError):
        record.name = 17.3
    with pytest.raises(ValueError):
        record.score = "foo"
    with pytest.raises(ValueError):
        record.strand = "foo"
Ejemplo n.º 3
0
def test_bedrecord__setters__unset_fields__at_end():
    record = BEDRecord("my_contig\t12\t345")

    record.name = "my_region"
    assert_equal(record.name, "my_region")

    record.score = -13
    assert_equal(record.score, -13)

    record.strand = '-'
    assert_equal(record.strand, '-')

    assert_equal(str(record), "my_contig\t12\t345\tmy_region\t-13\t-")
    assert_equal(
        repr(record), "BEDRecord(contig='my_contig', start=12, end=345, "
        "name='my_region', score=-13, strand='-')")
Ejemplo n.º 4
0
def test_bedrecord__setters__unset_fields__at_end():
    record = BEDRecord("my_contig\t12\t345")

    record.name = "my_region"
    assert_equal(record.name, "my_region")

    record.score = -13
    assert_equal(record.score, -13)

    record.strand = '-'
    assert_equal(record.strand, '-')

    assert_equal(str(record), "my_contig\t12\t345\tmy_region\t-13\t-")
    assert_equal(repr(record),
                 "BEDRecord(contig='my_contig', start=12, end=345, "
                 "name='my_region', score=-13, strand='-')")
Ejemplo n.º 5
0
def test_bedrecord__setters__unset_fields__at_end():
    record = BEDRecord("my_contig\t12\t345")

    record.name = "my_region"
    assert record.name == "my_region"

    record.score = -13
    assert record.score == -13

    record.strand = "-"
    assert record.strand == "-"

    assert str(record) == "my_contig\t12\t345\tmy_region\t-13\t-"
    assert (
        repr(record) == "BEDRecord(contig='my_contig', start=12, end=345, "
        "name='my_region', score=-13, strand='-')"
    )