def test_nested_matchers(): matcher = EachLike({"username": Term("[a-z]+", "user"), "id": Like(123)}) assert matcher.ruby_protocol() == { "json_class": "Pact::ArrayLike", "contents": { "username": { "json_class": "Pact::Term", "data": { "matcher": {"json_class": "Regexp", "s": "[a-z]+", "o": 0}, "generate": "user", }, }, "id": {"json_class": "Pact::SomethingLike", "contents": 123}, }, "min": 1, }
def test_nested_matchers(): matcher = EachLike({'username': Term('[a-z]+', 'user'), 'id': Like(123)}) assert matcher.ruby_protocol() == { 'json_class': 'Pact::ArrayLike', 'contents': { 'username': { 'json_class': 'Pact::Term', 'data': { 'matcher': { 'json_class': 'Regexp', 's': '[a-z]+', 'o': 0}, 'generate': 'user'}}, 'id': { 'json_class': 'Pact::SomethingLike', 'contents': 123}}, 'min': 1 }