mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
New filter plugin - unicode_normalization (#3359)
* Initial commit * Adding maintainer in BOTMETA * Adding changelog fragment * Updating filter_guide * Applying initial review suggestions
This commit is contained in:
parent
612543919e
commit
29e4066944
7 changed files with 122 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
shippable/posix/group2
|
||||
skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
|
|
@ -0,0 +1,39 @@
|
|||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: Test 'NFC' normalization
|
||||
assert:
|
||||
that:
|
||||
- u_umlaut != u_umlaut_combining
|
||||
- u_umlaut_combining != (u_umlaut_combining | community.general.unicode_normalize)
|
||||
- u_umlaut == (u_umlaut_combining | community.general.unicode_normalize)
|
||||
|
||||
- name: Test 'NFKC' normalization
|
||||
assert:
|
||||
that:
|
||||
- latin_capital_i != roman_numeral_one
|
||||
- latin_capital_i == (roman_numeral_one | community.general.unicode_normalize(form='NFKC'))
|
||||
|
||||
- name: Register invalid input type
|
||||
debug:
|
||||
msg: "{{ 1 | community.general.unicode_normalize }}"
|
||||
ignore_errors: true
|
||||
register: invalid_input_type
|
||||
|
||||
- name: Assert an invalid input type causes failure
|
||||
assert:
|
||||
that:
|
||||
- invalid_input_type is failed
|
||||
|
||||
- name: Register invalid form selection
|
||||
debug:
|
||||
msg: "{{ 'arbitrary text' | community.general.unicode_normalize(form='invalid') }}"
|
||||
ignore_errors: true
|
||||
register: invalid_form_selection
|
||||
|
||||
- name: Assert invalid form selection causes failure
|
||||
assert:
|
||||
that:
|
||||
- invalid_form_selection is failed
|
|
@ -0,0 +1,4 @@
|
|||
u_umlaut: "{{ '\u00fc' }}"
|
||||
u_umlaut_combining: "{{ 'u' + '\u0308' }}"
|
||||
roman_numeral_one: "{{ '\u2160' }}"
|
||||
latin_capital_i: "{{ '\u0049' }}"
|
Loading…
Add table
Add a link
Reference in a new issue