From 9d47b94da9ff943aeeee5146fb775ecc0a14e6d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez=20Mareque?= Date: Fri, 7 Feb 2025 22:05:40 +0100 Subject: [PATCH 1/2] feat: add expect (https://expects.readthedocs.io) snippets --- snippets/python/expects.json | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 snippets/python/expects.json diff --git a/snippets/python/expects.json b/snippets/python/expects.json new file mode 100644 index 00000000..58b38870 --- /dev/null +++ b/snippets/python/expects.json @@ -0,0 +1,62 @@ +{ + "Assert equal": { + "prefix": "ase", + "body": "expect(${1:expected}).to(equal(${2:actual})$0" + }, + "Assert not equal": { + "prefix": "asne", + "body": "expect(${1:expected}).not_to(equal(${2:actual})$0" + }, + "Assert raises": { + "prefix": "asr", + "body": "expect(${1:expected}).to(raise_error)$0" + }, + "Assert True": { + "prefix": "ast", + "body": "expect(${1:expected}).to(be_true)$0" + }, + "Assert False": { + "prefix": "asf", + "body": "expect(${1:expected}).to(be_false)$0" + }, + "Assert is": { + "prefix": "asi", + "body": "expect(${1:expected}).to(be(${2:actual})$0" + }, + "Assert is not": { + "prefix": "asint", + "body": "expect(${1:expected}).not_to(be(${2:actual})$0" + }, + "Assert is None": { + "prefix": "asino", + "body": "expect(${1:expected}).to(be_none)$0" + }, + "Assert is not None": { + "prefix": "asinno", + "body": "expect(${1:expected}).not_to(be_none)$0" + }, + "Assert Empty": { + "prefix": "ase", + "body": "expect(${1:expected}).to(be_empty)$0" + }, + "Assert not Empty": { + "prefix": "asne", + "body": "expect(${1:expected}).not_to(be_empty)$0" + }, + "Assert in": { + "prefix": "asin", + "body": "expect(${1:expected}).to(contain(${1:actual}))$0" + }, + "Assert not in": { + "prefix": "asni", + "body": "expect(${1:expected}).not_to(contain(${1:actual}))$0" + }, + "Assert key": { + "prefix": "ask", + "body": "expect(${1:expected}).to(have_key(${1:actual}))$0" + }, + "Assert not key": { + "prefix": "asnk", + "body": "expect(${1:expected}).not_to(have_key(${1:actual}))$0" + } +} From 2cf04a31dabf6cd40bab21a875de48090fa46e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20L=C3=B3pez=20Mareque?= Date: Mon, 21 Apr 2025 11:56:47 +0200 Subject: [PATCH 2/2] feat: add python-expects to the package.json --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index f33d7b10..c2985ea5 100644 --- a/package.json +++ b/package.json @@ -349,6 +349,10 @@ "language": "python", "path": "./snippets/python/debug.json" }, + { + "language": "python-expects", + "path": "./snippets/python/expects.json" + }, { "language": "pydoc", "path": "./snippets/python/pydoc.json"