Extract Method not prompting for duplicates?

Answered

According to the documentation, it seems like I should be able to use Extract Method which will then prompt me to replace duplicates. 

py_extract_method_duplicates

I can't seem to make that dialog box appear. Am I misreading the documentation?

 

Example code:

################################################################################
def test_localwx_club_positive():
username = 'TEST_localwxclub'
password = 'localwxclub'
pkgs = ['alphadailyobsextended5year', 'PKG_WSO']
wsu.setup_unlimited_user_with_specific_packages(username, password, pkgs)

return username, password

################################################################################
def test_pioneer_club_negative():
username = 'TEST_localwxclub'
password = 'localwxclub'
pkgs = ['alphadailyobsextended5year', 'PKG_WSO']
wsu.setup_unlimited_user_with_specific_packages(username, password, pkgs)

return username, password

I highlight the section that I want to extract, CTRL+ALT+M.

Give my new function a name. Click ok, and get...

 

0
2 comments

Hi Marcel!

At the moment duplicates are detected only inside the body of the same function or in other methods of the same class, even in trivial cases like that above (e.g. no global/nonlocal variables). I agree that it's weird that this functionality doesn't cover for multiple top-level functions of the same module. Could you please file an issue about that in our tracker?

0

Done: PY-21562  was created for this.

0

Please sign in to leave a comment.