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


# 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