Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdyas committed Mar 7, 2025
1 parent 1410ef5 commit 153d998
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rust/engine/dep_inference/src/python/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ fn dunder_import() {
) # pants: no-infer-dep",
&[],
);

// Concatenated strings are accepted.
assert_imports(
"
__import__(
Expand All @@ -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]) {
Expand Down

0 comments on commit 153d998

Please sign in to comment.