# Path: respite/formats.py
# class Format(object):
# class UnknownFormat(Exception):
#     def __init__(self, name, acronym, extensions, content_types, default_encoding=None):
#     def extension(self):
#     def content_type(self):
#     def __str__(self):
# def find(identifier):
# def find_by_name(name):
# def find_by_extension(extension):
# def find_by_content_type(content_type):
# FORMATS = [
#     Format('HyperText Markup Language', 'HTML', ['html'], ['text/html']),
#     Format('Extensible Markup Language', 'XML', ['xml'], ['application/xml', 'text/xml']),
#     Format('JavaScript Object Notation', 'JSON', ['json'], ['application/json'], 'UTF-8'),
#     Format('JavaScript', 'JS', ['js'], ['application/javascript'], 'UTF-8'),
#     Format('Yet Another Markup Language', 'YAML', ['yaml'], ['application/x-yaml'])
# ]


from nose.tools import *
from respite import formats
"""Tests for respite.formats."""


def test_find():
    format = formats.find('HTML')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_name():
    format = formats.find_by_name('HyperText Markup Language')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_extension():
    format = formats.find_by_extension('html')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_content_type():
    format = formats.find_by_content_type('text/html')

    assert_equal('HyperText Markup Language', format.name)

def test_preferred_extension():
    format = formats.find('HTML')

    assert_equal('html', format.extension)

def test_preferred_content_type():

# Path: respite/formats.py
# class Format(object):
# class UnknownFormat(Exception):
#     def __init__(self, name, acronym, extensions, content_types, default_encoding=None):
#     def extension(self):
#     def content_type(self):
#     def __str__(self):
# def find(identifier):
# def find_by_name(name):
# def find_by_extension(extension):
# def find_by_content_type(content_type):
# FORMATS = [
#     Format('HyperText Markup Language', 'HTML', ['html'], ['text/html']),
#     Format('Extensible Markup Language', 'XML', ['xml'], ['application/xml', 'text/xml']),
#     Format('JavaScript Object Notation', 'JSON', ['json'], ['application/json'], 'UTF-8'),
#     Format('JavaScript', 'JS', ['js'], ['application/javascript'], 'UTF-8'),
#     Format('Yet Another Markup Language', 'YAML', ['yaml'], ['application/x-yaml'])
# ]


# Path: tests/test_formats.py
from nose.tools import *
from respite import formats

"""Tests for respite.formats."""


def test_find():
    format = formats.find('HTML')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_name():
    format = formats.find_by_name('HyperText Markup Language')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_extension():
    format = formats.find_by_extension('html')

    assert_equal('HyperText Markup Language', format.name)

def test_find_by_content_type():
    format = formats.find_by_content_type('text/html')

    assert_equal('HyperText Markup Language', format.name)

def test_preferred_extension():
    format = formats.find('HTML')

    assert_equal('html', format.extension)

def test_preferred_content_type():

    format = formats.find('HTML')