From 8b782359dbccc22ab16bb750f65a5d95257e3054 Mon Sep 17 00:00:00 2001 From: David Poznik Date: Wed, 20 Mar 2024 10:33:46 -0700 Subject: [PATCH] Use list comparison in test (#31) --- CHANGELOG.md | 2 +- tests/test_tree.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f4506..61624dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [2.1.9] ### Fixed -- `Node.hg_snp` values would drift upon repeated `Tree` instantiation +- `Node.hg_snp` values of SNP-less intermediate branches now stable upon repeated `Tree` instantiation [2.1.9]: https://github.com/23andMe/yhaplo/compare/2.1.8..2.1.9 diff --git a/tests/test_tree.py b/tests/test_tree.py index 374cf8a..57d00c1 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -1,5 +1,3 @@ -import numpy as np - from yhaplo.config import Config from yhaplo.tree import Tree from yhaplo.utils.context_managers import logging_disabled @@ -11,7 +9,8 @@ def test_hg_snp_idempotency(): tree_1 = Tree(config) tree_2 = Tree(config) - hg_snps_1 = np.array([node.hg_snp for node in tree_1.depth_first_node_list]) - hg_snps_2 = np.array([node.hg_snp for node in tree_2.depth_first_node_list]) + assert extract_hg_snps(tree_1) == extract_hg_snps(tree_2) + - assert (hg_snps_1 == hg_snps_2).all() +def extract_hg_snps(tree): + return [node.hg_snp for node in tree.depth_first_node_list]