Skip to content

Commit 153d998

Browse files
committed
more tests
1 parent 1410ef5 commit 153d998

File tree

1 file changed

+7
-0
lines changed
  • src/rust/engine/dep_inference/src/python

1 file changed

+7
-0
lines changed

src/rust/engine/dep_inference/src/python/tests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ fn dunder_import() {
279279
) # pants: no-infer-dep",
280280
&[],
281281
);
282+
283+
// Concatenated strings are accepted.
282284
assert_imports(
283285
"
284286
__import__(
@@ -290,6 +292,11 @@ fn dunder_import() {
290292
",
291293
&["foo.bar.xyzzy.funky"],
292294
);
295+
296+
// f-strings with interpolations are ignored
297+
assert_imports("__import__(f'foo.{name}')", &[]);
298+
assert_imports("__import__(f'foo.{{name}}')", &[]);
299+
assert_imports("__import__(f'foo.bar\n')", &[]);
293300
}
294301

295302
fn assert_imports_strong_weak(code: &str, strong: &[&str], weak: &[&str]) {

0 commit comments

Comments
 (0)