"""Unit tests for catalog_utils.

Author:
Version:
"""

import catalog_utils


def test_parse_credits():
    pass


def test_json_to_catalog():
    pass


def test_load_catalog():
    pass


def test_get_dependencies():
    pass


def test_total_credits():
    pass


def test_available_classes():
    pass


def test_check_prerequisites():
    pass


# We're providing tests for format_course_info() because these
# kinds of tests are particularly annoying to write.

def test_format_course_info():
    catalog = catalog_utils.load_catalog("japn_catalog.json")

    # Test the default width...
    actual = catalog_utils.format_course_info("JAPN 231", catalog)
    expect = """Name: Intermediate Japanese I

Description: A thorough review of
grammar, vocabulary building,
conversation, composition, and reading.

Credits: 3-4

Prerequisites: JAPN 102

Dependencies: JAPN 101, JAPN 102"""
    assert actual == expect

    #  Test an alternate width...
    actual = catalog_utils.format_course_info("JAPN 231", catalog, width=80)
    expect = """Name: Intermediate Japanese I

Description: A thorough review of grammar, vocabulary building, conversation,
composition, and reading.

Credits: 3-4

Prerequisites: JAPN 102

Dependencies: JAPN 101, JAPN 102"""
    assert actual == expect

    #  Test a different course and a different width...
    actual = catalog_utils.format_course_info("JAPN 101", catalog, width=50)
    expect = """Name: Elementary Japanese I

Description: The fundamentals of Japanese through
listening, speaking, reading, and writing.

Credits: 4

Prerequisites:

Dependencies:"""
    assert actual == expect
