From 8a04bdc871adb876997ac1928736e98b477cd568 Mon Sep 17 00:00:00 2001 From: Rusty Geldmacher Date: Fri, 11 Dec 2020 13:50:43 -0500 Subject: [PATCH] Added a few more test cases Making sure multi-line empty dicts/arrays with and without comments still properly pass when `forbid: non-empty` is set. --- tests/rules/test_braces.py | 8 ++++++++ tests/rules/test_brackets.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/tests/rules/test_braces.py b/tests/rules/test_braces.py index 512f20a..cae7014 100644 --- a/tests/rules/test_braces.py +++ b/tests/rules/test_braces.py @@ -68,6 +68,14 @@ class ColonTestCase(RuleTestCase): ' a: 1\n', conf) self.check('---\n' 'dict: {}\n', conf) + self.check('---\n' + 'dict: {\n' + '}\n', conf) + self.check('---\n' + 'dict: {\n' + '# commented: value\n' + '# another: value2\n' + '}\n', conf) self.check('---\n' 'dict: {a}\n', conf, problem=(2, 8)) self.check('---\n' diff --git a/tests/rules/test_brackets.py b/tests/rules/test_brackets.py index 1d28e4a..41f20a7 100644 --- a/tests/rules/test_brackets.py +++ b/tests/rules/test_brackets.py @@ -68,6 +68,13 @@ class ColonTestCase(RuleTestCase): ' - b\n', conf) self.check('---\n' 'array: []\n', conf) + self.check('---\n' + 'array: [\n\n' + ']\n', conf) + self.check('---\n' + 'array: [\n' + '# a comment\n' + ']\n', conf) self.check('---\n' 'array: [a, b]\n', conf, problem=(2, 9)) self.check('---\n'