def test_distance_errors(pb_resources): with pytest.raises(AttributeError) as err: Pb.distance(pb_resources.get_one("m k"), method='foo') assert "foo is an invalid comparison method." in str(err) with pytest.raises(ValueError) as err: Pb.distance(pb_resources.get_one("o k"), method='ed') assert "Distance requires at least two trees." in str(err)
def test_distance_unknown_method(): with pytest.raises(AttributeError): Pb.distance(Pb.make_copy(pb_objects[0]), method='foo')
def test_distance_ed(phylobuddy, next_hash): tester = str(Pb.distance(phylobuddy, method='ed')) assert md5(tester.encode()).hexdigest() == next_hash
def test_distance_wrf(key, next_hash, pb_resources, hf): tester = pb_resources.get_one(key) output = str(Pb.distance(tester, method='wrf')) assert hf.string2hash(output) == next_hash