44def test_get_combinations_empty_list ():
55 """Test get_combinations with an empty list."""
66 assert get_combinations ([]) == []
7+ assert get_combinations ([], type = "indices" ) == []
8+ assert get_combinations ([], type = "values" ) == []
79
810def test_get_combinations_single_element ():
911 """Test get_combinations with a single element."""
1012 assert get_combinations ([0 ]) == []
13+ assert get_combinations ([0 ], type = "indices" ) == []
14+ assert get_combinations ([0 ], type = "values" ) == []
1115
1216def test_get_combinations_two_elements ():
1317 """Test get_combinations with two elements."""
1418 assert get_combinations ([0 , 1 ]) == [(0 , 1 )]
19+ assert get_combinations ([0 , 1 ], type = "indices" ) == [(0 , 1 )]
20+ assert get_combinations ([0 , 1 ], type = "values" ) == [(0 , 1 )]
1521
1622def test_get_combinations_multiple_elements ():
1723 """Test get_combinations with multiple elements."""
1824 z_ind = [0 , 1 , 2 , 3 ]
19- expected = [(0 , 1 ), (0 , 2 ), (0 , 3 ), (1 , 2 ), (1 , 3 ), (2 , 3 )]
20- assert get_combinations (z_ind ) == expected
25+ expected_indices = [(0 , 1 ), (0 , 2 ), (0 , 3 ), (1 , 2 ), (1 , 3 ), (2 , 3 )]
26+ expected_values = [(0 , 1 ), (0 , 2 ), (0 , 3 ), (1 , 2 ), (1 , 3 ), (2 , 3 )]
27+ assert get_combinations (z_ind ) == expected_indices
28+ assert get_combinations (z_ind , type = "indices" ) == expected_indices
29+ assert get_combinations (z_ind , type = "values" ) == expected_values
2130
2231def test_get_combinations_non_sequential_indices ():
2332 """Test get_combinations with non-sequential indices."""
2433 z_ind = [10 , 20 , 30 ]
25- expected = [(10 , 20 ), (10 , 30 ), (20 , 30 )] # Indices are based on values, not indices
26- assert get_combinations (z_ind ) == expected
34+ expected_indices = [(0 , 1 ), (0 , 2 ), (1 , 2 )]
35+ expected_values = [(10 , 20 ), (10 , 30 ), (20 , 30 )]
36+ assert get_combinations (z_ind ) == expected_indices
37+ assert get_combinations (z_ind , type = "indices" ) == expected_indices
38+ assert get_combinations (z_ind , type = "values" ) == expected_values
39+
40+ def test_get_combinations_mixed_values ():
41+ """Test get_combinations with mixed values."""
42+ z_ind = [0 , 10 , 20 , 30 ]
43+ expected_indices = [(0 , 1 ), (0 , 2 ), (0 , 3 ), (1 , 2 ), (1 , 3 ), (2 , 3 )]
44+ expected_values = [(0 , 10 ), (0 , 20 ), (0 , 30 ), (10 , 20 ), (10 , 30 ), (20 , 30 )]
45+ assert get_combinations (z_ind ) == expected_indices
46+ assert get_combinations (z_ind , type = "indices" ) == expected_indices
47+ assert get_combinations (z_ind , type = "values" ) == expected_values
48+
49+ def test_get_combinations_invalid_type ():
50+ """Test get_combinations with an invalid type."""
51+ with pytest .raises (ValueError ):
52+ get_combinations ([1 , 2 , 3 ], type = "invalid" )
0 commit comments