@pytest.mark.parametrize('content,expected', (('title: Hello', {'title': 'Hello'}), ('{"title": "Hello"}', {'title': 'Hello'}), ('{{ this }} is {{ bad }}', None)))
def test_parse_metadata(content, expected):
    if (expected is None):
        with pytest.raises(utils.BadMetadataError):
            utils.parse_metadata(content)
    else:
        assert (utils.parse_metadata(content) == expected)
@pytest.mark.parametrize('content,expected', (('title: Hello', {'title': 'Hello'}), ('{"title": "Hello"}', {'title': 'Hello'}), ('{{ this }} is {{ bad }}', None)))
def test_parse_metadata(content, expected):
    if (expected is None):
        with pytest.raises(utils.BadMetadataError):
            utils.parse_metadata(content)
    else:
        assert (utils.parse_metadata(content) == expected)