Skip to content

Commit 530687d

Browse files
committed
update tests
1 parent 3a2e1c6 commit 530687d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/node_table.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'a> NodeTable<'a> {
184184
/// is `true`.
185185
pub fn samples_as_vector(&self) -> Vec<tsk_id_t> {
186186
let mut samples: Vec<tsk_id_t> = vec![];
187-
for row self.iter(false) {
187+
for row in self.iter(false) {
188188
if row.flags & crate::TSK_NODE_IS_SAMPLE > 0 {
189189
samples.push(row.id);
190190
}
@@ -218,20 +218,19 @@ impl<'a> NodeTable<'a> {
218218
/// tables
219219
/// .add_node(tskit::TSK_NODE_IS_SAMPLE, 1.0, TSK_NULL, TSK_NULL)
220220
/// .unwrap();
221-
/// let samples = tables.create_node_id_vector(
222-
/// |row: &tskit::NodeTableRow, _: tsk_id_t| row.time > 0.,
221+
/// let samples = tables.nodes().create_node_id_vector(
222+
/// |row: &tskit::NodeTableRow| row.time > 0.,
223223
/// );
224224
/// assert_eq!(samples[0], 1);
225225
///
226226
/// // Get all nodes that have a mutation:
227227
///
228228
/// fn node_has_mutation(
229-
/// tables: &tskit::TableCollection,
229+
/// tabled_type: &dyn tskit::TableAccess,
230230
/// row: &tskit::NodeTableRow,
231-
/// i: tsk_id_t,
232231
/// ) -> bool {
233-
/// for mrow in tables.mutations_iter(false) {
234-
/// if mrow.node == i {
232+
/// for mrow in tabled_type.mutations_iter(false) {
233+
/// if mrow.node == row.id {
235234
/// return true;
236235
/// }
237236
/// }
@@ -241,8 +240,8 @@ impl<'a> NodeTable<'a> {
241240
/// // Get all nodes that have a mutation:
242241
///
243242
/// tables.add_mutation(0, 0, TSK_NULL, 0.0, None).unwrap();
244-
/// let samples_with_mut = tables.create_node_id_vector(
245-
/// |row: &tskit::NodeTableRow, i: tsk_id_t| node_has_mutation(&tables, row, i));
243+
/// let samples_with_mut = tables.nodes().create_node_id_vector(
244+
/// |row: &tskit::NodeTableRow| node_has_mutation(&tables, row));
246245
/// assert_eq!(samples_with_mut[0], 0);
247246
/// ```
248247
pub fn create_node_id_vector(

0 commit comments

Comments
 (0)