Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

ensure_import_from fails when top level module is imported #23

@vlopezferrando

Description

@vlopezferrando

The pattern ensure_import_from($source) , when matched with a $name should add from $source import $name.

Using this simple pattern, we can test it:

engine marzano(0.1)
language python

`$_` where {
    $import = "prod",
    $import <: ensure_import_from(source = `math`),
}

There are different scenarios for which its behavior is correct:

  1. There is no import from $source, so the import is added
  2. There are other imports from $source, so $name is added
  3. The import is already present, so nothing is done

But when there is a top level import $source, there is an error with the message:

Log: Trying to match against unbound variable $imports

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions