def test_update_parser_varname_assigns_new_name_to_parser_var__multiline(): lines = ''' import argparse from argparse import ArgumentParser parser = ArgumentParser(description='Example Argparse Program') parser.parse_args() '''.split('\n') line = "jarser = ArgumentParser(description='Example Argparse Program')" result = code_prep.update_parser_varname('jarser', lines)[2] assert line == result
def test_update_parser_varname_assigns_new_name_to_parser_var(): line = ["parser = ArgumentParser(description='Example Argparse Program')"] expected = "jarser = ArgumentParser(description='Example Argparse Program')" result = code_prep.update_parser_varname('jarser', line)[0] assert result == expected