Skip to content

The Inline Method refactoring does not inline all the attributes #827

@jonh-copin

Description

@jonh-copin

The Inline Method refactoring does not inline all the attributes, causing 'NameError'

Steps to reproduce the behavior:

  1. Code before refactoring:
_registry = {}

def get_registry():
    return _registry

def register(name, format_class):
    get_registry()[name] = format_class

def usa_register():
    print("antes:", get_registry())
    register("redis", "MockRedisFormat")
    print("depois:", get_registry())

usa_register()
  1. Apply the inline method to StringlikeMixin.find

  2. Code after refactoring:

_registry = {}

def get_registry():
    return _registry

def usa_register():
    print("antes:", get_registry())
    get_registry()[name] = "MockRedisFormat"
    print("depois:", get_registry())

usa_register()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or incorrect user-visible behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions