Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'TestURLConstruction' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'? #4334

Closed
sagitter opened this issue Jun 16, 2023 · 4 comments · Fixed by #4345

Comments

@sagitter
Copy link
Contributor

sagitter commented Jun 16, 2023

Hi all.

Setup

I am reporting a problem with Biopython be9f39d, Python 3.12.0~b2 in Fedora 39 (GCC-13.1.1):

Expected behaviour

No error

Actual behaviour

Python version: 3.12.0b2 (main, Jun 13 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)]
Operating system: posix linux
+ for test in `ls test_*.py | grep -v Nexus | grep -v Phylo | grep -v Tutorial | grep -v bgzf | grep -v SearchIO_blast | grep -v pairwise_aligner | grep -v SubsMat`
+ echo C
C
+ export PYTHONPATH=/builddir/build/BUILDROOT/python-biopython-1.82-0.1.20230615gitbe9f39d.fc39.aarch64/usr/lib64/python3.12/site-packages
+ PYTHONPATH=/builddir/build/BUILDROOT/python-biopython-1.82-0.1.20230615gitbe9f39d.fc39.aarch64/usr/lib64/python3.12/site-packages
+ /usr/bin/python3 run_tests.py --offline -v test_Entrez.py
test_Entrez ... /builddir/build/BUILDROOT/python-biopython-1.82-0.1.20230615gitbe9f39d.fc39.aarch64/usr/lib64/python3.12/site-packages/Bio/Entrez/__init__.py:694: UserWarning: 
            Email address is not specified.
            To make use of NCBI's E-utilities, NCBI requires you to specify your
            email address with each request.  As an example, if your email address
            is A.N.Other@example.com, you can specify it as follows:
               from Bio import Entrez
               Entrez.email = 'A.N.Other@example.com'
            In case of excessive usage of the E-utilities, NCBI will attempt to contact
            a user at the email address provided before blocking access to the
            E-utilities.
  warnings.warn(
FAIL
test_custom_directory (test_Entrez.CustomDirectoryTest.test_custom_directory) ... ok
test_construct_cgi_ecitmatch (test_Entrez.TestURLConstruction.test_construct_cgi_ecitmatch) ... ok
test_construct_cgi_efetch (test_Entrez.TestURLConstruction.test_construct_cgi_efetch) ... ok
test_construct_cgi_einfo (test_Entrez.TestURLConstruction.test_construct_cgi_einfo)
Test constructed url for request to Entrez. ... ok
test_construct_cgi_elink1 (test_Entrez.TestURLConstruction.test_construct_cgi_elink1) ... ok
test_construct_cgi_elink2 (test_Entrez.TestURLConstruction.test_construct_cgi_elink2)
Commas: Link from protein to gene. ... ok
test_construct_cgi_elink3 (test_Entrez.TestURLConstruction.test_construct_cgi_elink3)
Multiple ID entries: Find one-to-one links from protein to gene. ... ok
test_construct_cgi_epost1 (test_Entrez.TestURLConstruction.test_construct_cgi_epost1) ... ok
test_construct_cgi_epost2 (test_Entrez.TestURLConstruction.test_construct_cgi_epost2) ... ERROR
test_default_params (test_Entrez.TestURLConstruction.test_default_params)
Test overriding default values for the "email", "api_key", and "tool" parameters. ... ok
test_email_warning (test_Entrez.TestURLConstruction.test_email_warning)
Test issuing warning when user does not specify email address. ... ok
test_format_ids (test_Entrez.TestURLConstruction.test_format_ids) ... ok
test_has_api_key (test_Entrez.TestURLConstruction.test_has_api_key)
Test checking whether a Request object specifies an API key. ... ok
======================================================================
ERROR: test_construct_cgi_epost2 (test_Entrez.TestURLConstruction.test_construct_cgi_epost2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/biopython-be9f39d56d55d3f93c113cc20d2971bd91f84426/Tests/test_Entrez.py", line 212, in test_construct_cgi_epost2
    check_request_ids(self, query, variables["id"])
  File "/builddir/build/BUILD/biopython-be9f39d56d55d3f93c113cc20d2971bd91f84426/Tests/test_Entrez.py", line 129, in check_request_ids
    testcase.assertEquals(len(params["id"]), 1)
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TestURLConstruction' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?
----------------------------------------------------------------------
Ran 1 test in 4.165 seconds
FAILED (failures = 1)

Steps to reproduce

Full build log: output.txt

#4312

@peterjc
Copy link
Member

peterjc commented Jun 17, 2023

Looks like I missed that during #2319.

Do you want to submit a pull request fixing this?

@sagitter
Copy link
Contributor Author

Sorry for late reply; following patch is working against biopython-1.81:

--- a/Tests/test_Entrez.orig.py	2023-02-13 04:07:42.000000000 +0100
+++ b/Tests/test_Entrez.py	2023-06-30 14:42:58.177365639 +0200
@@ -126,7 +126,7 @@
     :type params: dict
     :param expected: Expected set of IDs, as colleciton of strings.
     """
-    testcase.assertEquals(len(params["id"]), 1)
+    testcase.assertEqual(len(params["id"]), 1)
     ids_str = params["id"][0]
     # Compare up to ordering
     testcase.assertCountEqual(ids_str.split(","), expected)

@peterjc
Copy link
Member

peterjc commented Jun 30, 2023

Would it be simple for you to turn that into a pull request on GitHub? For a tiny change like this I tend to do it all in their web-interface.

(I can make the change myself, but attributing it to you is more work)

sagitter added a commit to sagitter/biopython that referenced this issue Jul 1, 2023
@sagitter
Copy link
Contributor Author

sagitter commented Jul 1, 2023

Would it be simple for you to turn that into a pull request on GitHub? For a tiny change like this I tend to do it all in their web-interface.

(I can make the change myself, but attributing it to you is more work)

Done

mdehoon pushed a commit that referenced this issue Jul 1, 2023
* Fix issue #4334

* Update contributors files

* Alphabetical ordering

---------

Co-authored-by: Peter Cock <p.j.a.cock@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants