File test/config_hashdet.py artifact a32557b6af part of check-in b9be77c869


# title: rx.hash
# description: format consistency checks
# version: 0.1
#
# new rx.hash() should still allow some minor variances

import pytest
from pluginconf import rx



@pytest.mark.parametrize("_in,_out", [
    ["  var: y",       "^  {0,2}"],
    ["   var: y",      "^   {0,2}"],
    ["        var: y", "^        {0,2}"],
])
def spaces(_in, _out):
    assert rx.hash(_in).pattern == _out

@pytest.mark.parametrize("_in,_out", [
    [" # var: y",      r"^ {0,2}[#]{1,2} {0,2}"],
    [" ## var: y",     r"^ {0,2}[##]{1,3} {0,2}"],
    [" // var: y",     r"^ {0,2}[//]{1,3} {0,2}"],
    ["   **   var: y", r"^   {0,2}[**]{1,3}   {0,2}"],
    ["  /*  var: y",   r"^  {0,2}[/*]{1,3}  {0,2}"],
])
def hashvary(_in, _out):
    assert rx.hash(_in).pattern == _out