// Test a module with no owner (stdlib). This also sanity checks that we can handle when
// there is no parent module.
assert get_owner("typing") is None
// Test a module with a single owner with a top-level source root of ".". Also confirm we
// can handle when the module includes a symbol (like a class name) at the end.
rule_runner.create_file("script.py")
After Change
// requirement. Note that `colors.pyi` is at the top-level of the source root so that it strips
// to the module `colors`.
rule_runner.create_file("source_root1/colors.pyi")
rule_runner.add_to_build_file("source_root1", "python_library()")
assert get_owners("colors.red") == [
Address("3rdparty/python", target_name="ansicolors"),
Address("source_root1", relative_file_path="colors.pyi"),
]