Skip to content

Instantly share code, notes, and snippets.

@jdheywood
Forked from sinistamunkey/python.json
Created February 1, 2019 10:33
Show Gist options
  • Save jdheywood/14b1ecc129bb161b0992a6119a0c84ec to your computer and use it in GitHub Desktop.
Save jdheywood/14b1ecc129bb161b0992a6119a0c84ec to your computer and use it in GitHub Desktop.
VSCode snippets - Python
{
"test_case": {
"prefix": "test_case",
"body": [
"import unittest",
"",
"",
"class ${1:class_name}TestCase(unittest.TestCase):",
"",
" def test_${2:does_thing}(self):",
" self.assertFalse(True)"
],
"description": "Creates a stub test case"
},
"test": {
"prefix": "test",
"body": [
"def test_${1:does_thing}(self):",
" self.assertFalse(True)"
],
"description": "Creates a new test scenario"
},
"patch": {
"prefix": "patch",
"body": [
"${1:object}_patch = patch('${2:module}.${1:object}')",
"self.${1:object} = ${1:object}_patch.start()",
"self.addCleanup(${1:object}_patch.stop)"
],
"description": "Creates a new patch and sets a class based mock"
},
"property": {
"prefix": "prop",
"body": [
"@property",
"def ${1:name}(self):",
" return self._${1:name}"
],
"description": "Creates a new read only property"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment