-
-
Save jdheywood/14b1ecc129bb161b0992a6119a0c84ec to your computer and use it in GitHub Desktop.
VSCode snippets - Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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