def test_hash_seq_ids(alb_resources): tester = alb_resources.get_one("o p g") Alb.hash_ids(tester) assert len(tester.records()[0].id) == 10 tester = alb_resources.get_one("m d pr") Alb.hash_ids(tester, 25) assert len(tester.records()[0].id) == 25 assert len(tester.hash_map) == 34
def test_hash_seq_ids_errors(alb_resources): tester = alb_resources.get_one("o d f") with pytest.raises(TypeError) as e: Alb.hash_ids(tester, "foo") assert str(e.value) == "Hash length argument must be an integer, not <class 'str'>" with pytest.raises(ValueError) as e: Alb.hash_ids(tester, 0) assert str(e.value) == "Hash length must be greater than 0" tester.alignments *= 10 with pytest.raises(ValueError) as e: Alb.hash_ids(tester, 1) assert "Insufficient number of hashes available to cover all sequences." in str(e.value)