@@ -2594,18 +2594,33 @@ def ts_multiallelic_fixture():
25942594 return ts
25952595
25962596
2597+ def assert_no_norm_func (* _ ):
2598+ """Used in biallelic tests"""
2599+ raise Exception ("Normalisation function should not be called for biallelic sites" )
2600+
2601+
25972602@pytest .mark .parametrize ("stat" , SUMMARY_FUNCS .keys ())
2598- def test_general_two_locus_site_stat (stat , ts_100_samp_with_sites_fixture ):
2603+ def test_general_two_locus_site_stat_default_sample_sets (
2604+ stat , ts_100_samp_with_sites_fixture
2605+ ):
25992606 ts = ts_100_samp_with_sites_fixture
2600- sample_sets = [ts .samples ()[0 :50 ], ts .samples ()[50 :100 ]]
2601-
26022607 # In addition to not needing a normalisation function, normalisation is also
26032608 # not required because these sites are biallelic.
2604- def assert_no_norm_func (* _ ):
2605- raise Exception (
2606- "Normalisation function should not be called for biallelic sites"
2607- )
2609+ ldg = ts .two_locus_count_stat (
2610+ [ts .samples ()], getattr (GeneralStatFuncs , stat ), 2 , norm_f = assert_no_norm_func
2611+ )
2612+ ld = ts .ld_matrix (stat = stat ) # use default sample sets
2613+ np .testing .assert_array_almost_equal (ldg , ld )
2614+
26082615
2616+ @pytest .mark .parametrize ("stat" , SUMMARY_FUNCS .keys ())
2617+ def test_general_two_locus_site_stat_two_sample_sets (
2618+ stat , ts_100_samp_with_sites_fixture
2619+ ):
2620+ ts = ts_100_samp_with_sites_fixture
2621+ sample_sets = [ts .samples ()[0 :50 ], ts .samples ()[50 :100 ]]
2622+ # In addition to not needing a normalisation function, normalisation is also
2623+ # not required because these sites are biallelic.
26092624 ldg = ts .two_locus_count_stat (
26102625 sample_sets , getattr (GeneralStatFuncs , stat ), 2 , norm_f = assert_no_norm_func
26112626 )
0 commit comments