From 153d998d26fe8413bb48953cf05a11e07cfe866d Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Thu, 6 Mar 2025 23:43:18 -0500 Subject: [PATCH] more tests --- src/rust/engine/dep_inference/src/python/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rust/engine/dep_inference/src/python/tests.rs b/src/rust/engine/dep_inference/src/python/tests.rs index f4a7c8099c4..fb300b50cf6 100644 --- a/src/rust/engine/dep_inference/src/python/tests.rs +++ b/src/rust/engine/dep_inference/src/python/tests.rs @@ -279,6 +279,8 @@ fn dunder_import() { ) # pants: no-infer-dep", &[], ); + + // Concatenated strings are accepted. assert_imports( " __import__( @@ -290,6 +292,11 @@ fn dunder_import() { ", &["foo.bar.xyzzy.funky"], ); + + // f-strings with interpolations are ignored + assert_imports("__import__(f'foo.{name}')", &[]); + assert_imports("__import__(f'foo.{{name}}')", &[]); + assert_imports("__import__(f'foo.bar\n')", &[]); } fn assert_imports_strong_weak(code: &str, strong: &[&str], weak: &[&str]) {