Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- with open('list.txt', 'r') as thefile: # Open the file.
- lines = [x.strip().upper() for x in thefile.readlines()]
- current_line = 0
- delete=''
- while current_line < len(lines):
- if '*' in lines[current_line]:
- t = lines[current_line].replace('*', delete)
- #t = t[:-1] # Remove line break.
- f = open('{}.feature'.format(t.lower()), 'w') # Open file.
- t = t.replace('_', '') # Remove the _.
- lang = t[-2:] # Get language.
- t = t[:-3] # Remove language from line.
- f.write('@{}_setup\n'.format(t.lower())) # Insert decorator.
- if '+' in lines[current_line]:
- f.write('Feature: [{}] {}\n'.format(lang.lower(), lines[current_line]).capitalize().replace('+', delete))
- if '-' in lines[current_line]:
- s=lines[current_line].lower()
- f.write('\n') # Line break.
- f.write(' @{}\n'.format(lang.lower())) # Language.
- # Write the composite line in the file.
- f.write(' Scenario: [{}] Validate {}\n'.format(lang.lower(), s.replace('-', delete)))
- f.write('\n') # Line break.
- current_line += 1
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement