petermr / amiclimate

software and material for managing climate knowledge
Apache License 2.0
0 stars 0 forks source link

test/test_un.py::TestIPCC::test_ipcc_syr_lr_toc - AssertionError #8

Open flower1430 opened 6 months ago

flower1430 commented 6 months ago
"C:\Program Files\Python39\python.exe" "C:/Program Files/JetBrains/PyCharm Community Edition 2023.2.5/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py" --target test_un.py::TestIPCC.test_ipcc_syr_lr_toc 
Testing started at 10:32 AM ...
Launching pytest with arguments test_un.py::TestIPCC::test_ipcc_syr_lr_toc --no-header --no-summary -q in C:\Users\ADMIN\Desktop\sc_pyami\amiclimate\test

============================= test session starts =============================
collecting ... collected 1 item

test_un.py::TestIPCC::test_ipcc_syr_lr_toc 

======================== 1 failed in 60.67s (0:01:00) =========================
FAILED                        [100%]
test\test_un.py:1190 (TestIPCC.test_ipcc_syr_lr_toc)
'Chapter 3: Mitigation pathways compatible with long-term goals' != 'SYR Longer Report'

Expected :'SYR Longer Report'
Actual   :'Chapter 3: Mitigation pathways compatible with long-term goals'
<Click to see difference>

self = <test.test_un.TestIPCC testMethod=test_ipcc_syr_lr_toc>

    def test_ipcc_syr_lr_toc(self):
        """analyses contents for IPCC syr longer report
        """
        """
            <!-- TOC (from UNFCCC)-->
            <div class="toc">

                <div>
                    <span>Decision</span><span>Page</span></a>
                </div>

                <nav role="doc-toc">
                    <ul>
                        <li>
                            <a href="../Decision_1_CMA_3/split.html"><span class="descres-code">1/CMA.3</span><span
                                    class="descres-title">Glasgow Climate Pact</span></a>
                        </li>
                       ...
                    </ul>
                </nav>
            </div>
        """
        report = 'longer-report'
        syr_lr_content = Path(Resources.TEST_RESOURCES_DIR, IPCC_DIR, CLEANED_CONTENT, SYR,
                              SYR_LR, HTML_WITH_IDS_HTML)
        assert syr_lr_content.exists()
        lr_html = ET.parse(str(syr_lr_content), HTMLParser())
        assert lr_html is not None
        body = HtmlLib.get_body(lr_html)
        header_h1 = body.xpath("div//h1")[0]
        assert header_h1 is not None
        header_h1_text = header_h1.text
        toc_title = "SYR Longer Report"
>       assert header_h1_text == toc_title
E       AssertionError: assert 'Chapter 3: Mitigation pathways compatible with long-term goals' == 'SYR Longer Report'
E         - SYR Longer Report
E         + Chapter 3: Mitigation pathways compatible with long-term goals

test_un.py:1224: AssertionError

Process finished with exit code 1
petermr commented 6 months ago

This looks like a confusion of files . We should analyse it together

On Tue, May 14, 2024 at 6:05 AM flower1430 @.***> wrote:

"C:\Program Files\Python39\python.exe" "C:/Program Files/JetBrains/PyCharm Community Edition 2023.2.5/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py" --target test_un.py::TestIPCC.test_ipcc_syr_lr_toc Testing started at 10:32 AM ... Launching pytest with arguments test_un.py::TestIPCC::test_ipcc_syr_lr_toc --no-header --no-summary -q in C:\Users\ADMIN\Desktop\sc_pyami\amiclimate\test

============================= test session starts ============================= collecting ... collected 1 item

test_un.py::TestIPCC::test_ipcc_syr_lr_toc

======================== 1 failed in 60.67s (0:01:00) ========================= FAILED [100%] test\test_un.py:1190 (TestIPCC.test_ipcc_syr_lr_toc) 'Chapter 3: Mitigation pathways compatible with long-term goals' != 'SYR Longer Report'

Expected :'SYR Longer Report' Actual :'Chapter 3: Mitigation pathways compatible with long-term goals'

self = def test_ipcc_syr_lr_toc(self): """analyses contents for IPCC syr longer report """ """
DecisionPage
""" report = 'longer-report' syr_lr_content = Path(Resources.TEST_RESOURCES_DIR, IPCC_DIR, CLEANED_CONTENT, SYR, SYR_LR, HTML_WITH_IDS_HTML) assert syr_lr_content.exists() lr_html = ET.parse(str(syr_lr_content), HTMLParser()) assert lr_html is not None body = HtmlLib.get_body(lr_html) header_h1 = body.xpath("div//h1")[0] assert header_h1 is not None header_h1_text = header_h1.text toc_title = "SYR Longer Report" > assert header_h1_text == toc_title E AssertionError: assert 'Chapter 3: Mitigation pathways compatible with long-term goals' == 'SYR Longer Report' E - SYR Longer Report E + Chapter 3: Mitigation pathways compatible with long-term goals test_un.py:1224: AssertionError Process finished with exit code 1 — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

xpriyanshux commented 6 months ago

getting the same error on windows 11 Python 3.10.11