# Path: hq/hquery/syntax_error.py
# class HquerySyntaxError(ValueError):
#     pass
# 
# Path: test/common_test_util.py
# def expected_result(contents):
#     return dedent(contents.lstrip('\n'))
# 
# Path: test/hquery/hquery_test_util.py
# def query_html_doc(html_body, hquery, preserve_space=False, wrap_body=True):
#     soup = soup_with_body(html_body) if wrap_body else make_soup(html_body)
#     raw_result = HqueryProcessor(hquery, preserve_space=preserve_space).query(soup)
#     return eliminate_blank_lines(convert_results_to_output_text(raw_result, preserve_space=preserve_space).strip())


import os
import re
import sys
from hq.hquery.syntax_error import HquerySyntaxError
from pytest import raises
from ..common_test_util import expected_result
from test.hquery.hquery_test_util import query_html_doc
    <div id="not selected">
        <div id="selected">
            <div></div>
        </div>
    </div>"""
    assert query_html_doc(html_body, '/html/body/div/div/self::div') == expected_result("""
    <div id="selected">
     <div>
     </div>
    </div>""")


def test_css_class_axis_finds_elements_based_on_their_css_classes():
    html_body = """
    <p class="foo">foo</p>
    <p class="foo bar">foo bar</p>
    <p class="bar">bar</p>"""
    expected = expected_result("""
    <p class="foo bar">
     foo bar
    </p>
    <p class="bar">
     bar
    </p>""")

    assert query_html_doc(html_body, '//class::bar') == expected
    assert query_html_doc(html_body, '//.::bar') == expected


def test_css_class_axis_can_only_be_followed_by_name_test():

# Path: hq/hquery/syntax_error.py
# class HquerySyntaxError(ValueError):
#     pass
# 
# Path: test/common_test_util.py
# def expected_result(contents):
#     return dedent(contents.lstrip('\n'))
# 
# Path: test/hquery/hquery_test_util.py
# def query_html_doc(html_body, hquery, preserve_space=False, wrap_body=True):
#     soup = soup_with_body(html_body) if wrap_body else make_soup(html_body)
#     raw_result = HqueryProcessor(hquery, preserve_space=preserve_space).query(soup)
#     return eliminate_blank_lines(convert_results_to_output_text(raw_result, preserve_space=preserve_space).strip())


# Path: test/hquery/test_axes.py
import os
import re
import sys
from hq.hquery.syntax_error import HquerySyntaxError
from pytest import raises
from ..common_test_util import expected_result
from test.hquery.hquery_test_util import query_html_doc

    <div id="not selected">
        <div id="selected">
            <div></div>
        </div>
    </div>"""
    assert query_html_doc(html_body, '/html/body/div/div/self::div') == expected_result("""
    <div id="selected">
     <div>
     </div>
    </div>""")


def test_css_class_axis_finds_elements_based_on_their_css_classes():
    html_body = """
    <p class="foo">foo</p>
    <p class="foo bar">foo bar</p>
    <p class="bar">bar</p>"""
    expected = expected_result("""
    <p class="foo bar">
     foo bar
    </p>
    <p class="bar">
     bar
    </p>""")

    assert query_html_doc(html_body, '//class::bar') == expected
    assert query_html_doc(html_body, '//.::bar') == expected


def test_css_class_axis_can_only_be_followed_by_name_test():

    with raises(HquerySyntaxError):