Skip to content

Commit 5f63840

Browse files
committed
update insta and fix the deprecations
1 parent 67e74b8 commit 5f63840

File tree

3 files changed

+49
-49
lines changed

3 files changed

+49
-49
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ anyhow = "1.0.75"
2828
arbitrary = { version = "1.3.2", features = ["derive"] }
2929
clap = { version = "4.4.10", features = ["derive"] }
3030
env_logger = "0.10.1"
31-
insta = "1.34.0"
31+
insta = "1.39.0"
3232
instant-distance = "0.6.1"
3333
rand = { version = "0.8.5", features = ["std_rng"] }
3434
tempfile = "3.8.1"

src/tests/reader.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn open_unfinished_db() {
3434

3535
let rtxn = handle.env.read_txn().unwrap();
3636
let ret = Reader::<Euclidean>::open(&rtxn, 0, handle.database).map(|_| ()).unwrap_err();
37-
insta::assert_display_snapshot!(ret, @"Metadata are missing on index 0, You must build your database before attempting to read it");
37+
insta::assert_snapshot!(ret, @"Metadata are missing on index 0, You must build your database before attempting to read it");
3838
}
3939

4040
#[test]
@@ -50,7 +50,7 @@ fn open_db_with_wrong_dimension() {
5050
let rtxn = handle.env.read_txn().unwrap();
5151
let reader = Reader::<Euclidean>::open(&rtxn, 0, handle.database).unwrap();
5252
let ret = reader.nns_by_vector(&rtxn, &[1.0, 2.0, 3.0], 5, None, None).unwrap_err();
53-
insta::assert_display_snapshot!(ret, @"Invalid vector dimensions. Got 3 but expected 2");
53+
insta::assert_snapshot!(ret, @"Invalid vector dimensions. Got 3 but expected 2");
5454
}
5555

5656
#[test]
@@ -89,7 +89,7 @@ fn search_in_db_with_a_single_vector() {
8989
let reader = Reader::<Angular>::open(&rtxn, 0, handle.database).unwrap();
9090

9191
let ret = reader.nns_by_item(&rtxn, 0, 1, None, None).unwrap();
92-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
92+
insta::assert_snapshot!(NnsRes(ret), @r###"
9393
id(0): distance(0)
9494
"###);
9595
}
@@ -113,14 +113,14 @@ fn two_dimension_on_a_line() {
113113

114114
// if we can't look into enough nodes we find some random points
115115
let ret = reader.nns_by_item(&rtxn, 0, 5, NonZeroUsize::new(1), None).unwrap();
116-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
116+
insta::assert_snapshot!(NnsRes(ret), @r###"
117117
id(48): distance(48)
118118
id(92): distance(92)
119119
"###);
120120

121121
// if we can look into all the node there is no inifinite loop and it works
122122
let ret = reader.nns_by_item(&rtxn, 0, 5, NonZeroUsize::new(usize::MAX), None).unwrap();
123-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
123+
insta::assert_snapshot!(NnsRes(ret), @r###"
124124
id(0): distance(0)
125125
id(1): distance(1)
126126
id(2): distance(2)
@@ -129,7 +129,7 @@ fn two_dimension_on_a_line() {
129129
"###);
130130

131131
let ret = reader.nns_by_item(&rtxn, 0, 5, None, None).unwrap();
132-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
132+
insta::assert_snapshot!(NnsRes(ret), @r###"
133133
id(1): distance(1)
134134
id(2): distance(2)
135135
id(3): distance(3)
@@ -160,7 +160,7 @@ fn two_dimension_on_a_column() {
160160
let reader = Reader::<Euclidean>::open(&rtxn, 0, handle.database).unwrap();
161161
let ret = reader.nns_by_item(&rtxn, 0, 5, None, None).unwrap();
162162

163-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
163+
insta::assert_snapshot!(NnsRes(ret), @r###"
164164
id(1): distance(1)
165165
id(2): distance(2)
166166
id(3): distance(3)
@@ -208,14 +208,14 @@ fn filtering() {
208208
let reader = Reader::<Euclidean>::open(&rtxn, 0, handle.database).unwrap();
209209

210210
let ret = reader.nns_by_item(&rtxn, 0, 5, None, Some(&RoaringBitmap::from_iter(0..2))).unwrap();
211-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
211+
insta::assert_snapshot!(NnsRes(ret), @r###"
212212
id(0): distance(0)
213213
id(1): distance(1)
214214
"###);
215215

216216
let ret =
217217
reader.nns_by_item(&rtxn, 0, 5, None, Some(&RoaringBitmap::from_iter(98..1000))).unwrap();
218-
insta::assert_display_snapshot!(NnsRes(ret), @r###"
218+
insta::assert_snapshot!(NnsRes(ret), @r###"
219219
id(98): distance(98)
220220
id(99): distance(99)
221221
"###);

0 commit comments

Comments
 (0)