Skip to content

Commit

Permalink
(2.03) Render 'condition' when present in atleast_one rule #156
Browse files Browse the repository at this point in the history
  • Loading branch information
samuele-mattiuzzo committed Mar 7, 2019
1 parent 084c15c commit 648adc5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions iatirulesets/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ def rules_text(rules, reduced_path, show_all=False):
out.append('``{0}`` must not be present if ``{1}`` are present.'.format(case_path, human_list(other_paths)))
break
elif rule == 'atleast_one':
cond = case.get('condition', None)
cond = '.' if not cond else ' if {}'.format(cond)

if other_paths:
out.append('Either ``{0}`` or ``{1}`` must be present.'.format(case_path, human_list(other_paths)))
out.append('Either ``{0}`` or ``{1}`` must be present{2}'.format(case_path, human_list(other_paths), cond))
break
else:
out.append('``{0}`` must be present.'.format(case_path))
out.append('``{0}`` must be present{1}'.format(case_path, cond))

elif rule == 'only_one_of':
out.append('``{0}`` must not be present alongisde ``{1}``.'.format(case_path, human_list(case['excluded'], 'and')))
elif rule == 'startswith':
Expand Down

0 comments on commit 648adc5

Please sign in to comment.