

import pytest

from osp.common.utils import prettify


@pytest.mark.parametrize('ugly,pretty', [

    # Unchanged
    ('The City of God', 'The City of God'),

    # Titlecase
    ('the city of god', 'The City of God'),
    ('THE CITY OF GOD', 'The City of God'),

    # Strip punctuation
    ('The City of God.', 'The City of God'),
    ('The City of God /', 'The City of God'),
    ('The City of God,', 'The City of God'),

    # Strip whitespace
    ('  The City of God  ', 'The City of God'),

    # Keep periods after right-side initials
    ('<NAME>.', '<NAME>.'),
    ('mcclure, david w.', '<NAME>.'),

    # Keep right-size parens / brackets.
    ('<NAME>. (David)', '<NAME>. (David)'),
    ('<NAME>. [David]', '<NAME>. [David]'),

])
def test_parse_domain(ugly, pretty):
    assert prettify(ugly) == pretty



import pytest

from osp.common.utils import prettify


@pytest.mark.parametrize('ugly,pretty', [

    # Unchanged
    ('The City of God', 'The City of God'),

    # Titlecase
    ('the city of god', 'The City of God'),
    ('THE CITY OF GOD', 'The City of God'),

    # Strip punctuation
    ('The City of God.', 'The City of God'),
    ('The City of God /', 'The City of God'),
    ('The City of God,', 'The City of God'),

    # Strip whitespace
    ('  The City of God  ', 'The City of God'),

    # Keep periods after right-side initials
    ('<NAME>.', '<NAME>.'),
    ('mcclure, david w.', '<NAME>.'),

    # Keep right-size parens / brackets.
    ('<NAME>. (David)', '<NAME>. (David)'),
    ('<NAME>. [David]', '<NAME>. [David]'),

])
def test_parse_domain(ugly, pretty):
    assert prettify(ugly) == pretty

# Unchanged # Titlecase # Strip punctuation # Strip whitespace # Keep periods after right-side initials # Keep right-size parens / brackets.