# Path: importer/parsexml.py
# def file_to_element_tree(path):
# def parse_selected_sections(object, *args):
#     def _text_or_none(element):
#     def __init__(self, entry, valid_combinations):
#     def __str__(self):
# def expect_section_combinations(entry, object, combinations):
# def expect_valid_date_combinations(entry, object):
# def sections_to_date_entry(sections):
# def sanitise_string(string):
# def sanitise_field_values(structure):
# def warning(filename, msg):
# def get_author_name(author_element):
# def parse_element_tree(tree, filename=None):
# def main(argv=None):
# class InvalidCombinationExpection(Exception):


import sys
from importer import parsexml
from nose_parameterized import parameterized
from six.moves import StringIO
from testtools import (ExpectedException, TestCase)
from testtools.matchers import (Contains,
                                Equals,
                                Is)
from xml.etree import ElementTree

EXPECTED_ENTRY_VALUES = {
    "Author": ["fore_name last_name"],
    "pubDate": {
        "date": "2011-11-11",
        "components": {
            "Year": True,
            "Month": True,
            "Day": True
        }
    },
    "reviseDate": {
        "date": "2012-11-11",
        "components": {
            "Year": True,
            "Month": True,
            "Day": True
        }
    },
    "ISSN": "0",
    "country": "Australia"
}


class TestFileToElementTree(TestCase):
    """Test conversion of a file to an element tree."""

    def test_convert(self):
        """4.5.3.1 File can be converted to element tree."""
        stream = StringIO("<html></html>")

# Path: importer/parsexml.py
# def file_to_element_tree(path):
# def parse_selected_sections(object, *args):
#     def _text_or_none(element):
#     def __init__(self, entry, valid_combinations):
#     def __str__(self):
# def expect_section_combinations(entry, object, combinations):
# def expect_valid_date_combinations(entry, object):
# def sections_to_date_entry(sections):
# def sanitise_string(string):
# def sanitise_field_values(structure):
# def warning(filename, msg):
# def get_author_name(author_element):
# def parse_element_tree(tree, filename=None):
# def main(argv=None):
# class InvalidCombinationExpection(Exception):


# Path: test/test_parsexml.py
import sys
from importer import parsexml
from nose_parameterized import parameterized
from six.moves import StringIO
from testtools import (ExpectedException, TestCase)
from testtools.matchers import (Contains,
                                Equals,
                                Is)
from xml.etree import ElementTree


EXPECTED_ENTRY_VALUES = {
    "Author": ["fore_name last_name"],
    "pubDate": {
        "date": "2011-11-11",
        "components": {
            "Year": True,
            "Month": True,
            "Day": True
        }
    },
    "reviseDate": {
        "date": "2012-11-11",
        "components": {
            "Year": True,
            "Month": True,
            "Day": True
        }
    },
    "ISSN": "0",
    "country": "Australia"
}


class TestFileToElementTree(TestCase):
    """Test conversion of a file to an element tree."""

    def test_convert(self):
        """4.5.3.1 File can be converted to element tree."""
        stream = StringIO("<html></html>")

        parsexml.file_to_element_tree(stream)