def test():
    """
    >>> # replace a single tag
    >>> content = { 'pattern1': ['a']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern1')
    'a'

    >>> # replace a tag
    >>> content = { 'pattern2': ['a'], 'pattern1': ['<#pattern2#>']}
    >>> bw = BlurbWriter(content)

    >>> bw.write('pattern2')
    'a'
    >>> bw.write('pattern1')
    'a'

    >>> # to lowercasee
    >>> content = { 'pattern2': ['AA'], 'pattern1': ['<#~,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'AA'
    >>> bw.write('pattern1')
    'aa'

    >>> # white space to underscore
    >>> content = { 'pattern2': ['A A'], 'pattern1': ['<#_,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'A A'
    >>> bw.write('pattern1')
    'A_A'

    >>> # remove nonletters
    >>> content = { 'pattern2': ['A. A-'], 'pattern1': ['<#@,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'A. A-'
    >>> bw.write('pattern1')
    'AA'

    >>> # white space to underscore and first cap
    >>> content = { 'pattern2': ['a a'], 'pattern1': ['<#^_,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'a a'
    >>> bw.write('pattern1')
    'A_a'

    >>> # make title case
    >>> content = { 'pattern2': ['aa aa'], 'pattern1': ['<#^^,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'aa aa'
    >>> bw.write('pattern1')
    'Aa Aa'

    >>> # make allcaps
    >>> content = { 'pattern2': ['aa aa'], 'pattern1': ['<#^^^,pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'aa aa'
    >>> bw.write('pattern1')
    'AA AA'

    >>> # generate a random number
    >>> content = { 'pattern1': ['<-randint(1, 20)->']}
    >>> bw = BlurbWriter(content)
    >>> result = bw.write('pattern1')
    >>> assert 1 <= int(result) <= 20

    >>> # detect spinning because of a malformed tag
    >>> content = { 'pattern2': ['a'], 'pattern1': ['<#pattern2>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'a'
    >>> bw.write('pattern1')
    '<#pattern2>'

    >>> # replace a tag, variable
    >>> # '<#_aname=name#><#_aname#>’s
    >>> content = { 'pattern2': ['a'], 'pattern1': ['<#varName=pattern2#>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'a'
    >>> bw.write('pattern1')
    ''

    >>> # replace a tag, whitespace
    >>> content = { 'pattern2': ['a'], 'pattern1': ['<#    pattern2    #>']}
    >>> bw = BlurbWriter(content)
    >>> bw.write('pattern2')
    'a'
    >>> bw.write('pattern1')
    'a'

    # >>> # prefix an / a article for a result based on consonant / vowel
    # >>> content = { 'pattern2': ['a'], 'pattern1': ['<#article, pattern2#>'],  'pattern4': ['b'], 'pattern3': ['<#article, pattern4#>']}
    # >>> bw = BlurbWriter(content)
    # >>> bw.write('pattern1')
    # 'an a'
    # >>> bw.write('pattern3')
    # 'a b'

    # >>> # replace a nested tag
    # >>> content = { 'pattern2': ['pattern'], 'pattern1': ['<#<#pattern2#>3#>'], 'pattern3': ['b']}
    # >>> bw = BlurbWriter(content)
    # >>> bw.write('pattern1')
    # 'b'

    # >>> # capitalisation of first character
    # >>> content = { 'pattern1': ['<#^,pattern2#>'], 'pattern2': ['aa aa']}
    # >>> bw = BlurbWriter(content)
    # >>> bw.write('pattern1')
    # 'Aa aa'

    # >>> # unicode content
    # >>> content = { 'pattern1': ['üößé']}
    # >>> bw = BlurbWriter(content)
    # >>> bw.write('pattern1')
    # 'üößé'

    # # not sure if that is the right way

    # >>> # replace a tag
    # >>> content = { 'pattern2': ['a'], 'pattern1': ['<#pattern2#>']}
    # >>> bw = BlurbWriter(content, debug=True)
    # >>> bw.write('pattern2')
    # pattern2
    # 'a'
    # >>> bw.write('pattern1')
    # pattern1
    # pattern2
    # 'a'
    """
