Skip to content

Instantly share code, notes, and snippets.

@purpleP
Created May 24, 2016 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purpleP/f8797893e68af6b8c6c7573078a33d6b to your computer and use it in GitHub Desktop.
Save purpleP/f8797893e68af6b8c6c7573078a33d6b to your computer and use it in GitHub Desktop.
some python snippets for ultisnip
snippet fixture "pytest fixture" b
@pytest.fixture(${1})
def ${2}(${3}):
${4}
endsnippet
snippet parametrize "pytest parametrize test" b
@pytest.mark.parametrize(${1:''}, ${2:()})
def ${3}(${4}):
${5}
endsnippet
snippet de "Python function" b
def ${1:name}(${2:params}):
${3:pass}
`!p
import re
t[1] = t[1].replace(' ', '_')
t[2] = re.sub('([^,])(\s+)', r'\1_', t[2])
`
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment