Skip to content

Commit

Permalink
bug fix Grokzen#169 and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
swills committed May 5, 2020
1 parent f96b76e commit 464e02c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pykwalify/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ def init_mapping_value(self, v, rule, path):
v = {}

# Check if this is a regex rule. Handle specially
if k.startswith("regex;") or k.startswith("re;"):
if str(k).startswith("regex;") or str(k).startswith("re;"):
log.debug(u"Found regex map rule")
regex = k.split(";", 1)
if len(regex) != 2:
Expand Down
16 changes: 15 additions & 1 deletion tests/files/success/test_mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,18 @@ schema:
type: map
mapping:
regex;(person[1-9]):
required: True
required: True
---
name: mapping 20
desc: Test mapping with integer keys
data:
test:
0: test
schema:
type: map
mapping:
test:
type: map
mapping:
0:
type: str

0 comments on commit 464e02c

Please sign in to comment.