Tests: indentation: Test the indent stack
The "indentation stack" is iteratively built by the `check()` function of the indentation rule. It is important, since everything in the rule relies on it. This patch adds tests to make sure the stack is correctly built for some known structures.
This commit is contained in:
@@ -155,6 +155,7 @@ CONF = {'spaces': int,
|
||||
'check-multi-line-strings': bool}
|
||||
|
||||
ROOT, B_MAP, F_MAP, B_SEQ, F_SEQ, B_ENT, KEY, VAL = range(8)
|
||||
labels = ('ROOT', 'B_MAP', 'F_MAP', 'B_SEQ', 'F_SEQ', 'B_ENT', 'KEY', 'VAL')
|
||||
|
||||
|
||||
class Parent(object):
|
||||
@@ -165,6 +166,9 @@ class Parent(object):
|
||||
self.explicit_key = False
|
||||
self.implicit_block_seq = False
|
||||
|
||||
def __repr__(self):
|
||||
return '%s:%d' % (labels[self.type], self.indent)
|
||||
|
||||
|
||||
def check_scalar_indentation(conf, token, context):
|
||||
if token.start_mark.line == token.end_mark.line:
|
||||
|
||||
Reference in New Issue
Block a user