From d9a287877d911302bc29fbe0e81736b754e38526 Mon Sep 17 00:00:00 2001 From: "Arian R. Jamasb" Date: Thu, 1 Aug 2024 17:22:09 +0200 Subject: [PATCH] linting: remove print statements from tests --- tests/mmcif/test_read_mmcif.py | 10 +++------- tests/mmtf/test_write_mmtf.py | 2 -- tests/pdb/test_amino3to1.py | 9 ++------- tests/pdb/test_read_pdb.py | 7 +++---- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/tests/mmcif/test_read_mmcif.py b/tests/mmcif/test_read_mmcif.py index e2a907b..a9888ef 100644 --- a/tests/mmcif/test_read_mmcif.py +++ b/tests/mmcif/test_read_mmcif.py @@ -11,6 +11,7 @@ import importlib.resources as pkg_resources else: import importlib_resources as pkg_resources + from pathlib import Path from urllib.error import HTTPError @@ -97,7 +98,6 @@ def test__read_pdb(): """Test private _read_pdb""" ppdb = PandasMmcif() _, txt = ppdb._read_mmcif(TESTDATA_FILENAME) - print(txt) assert txt == three_eiy @@ -336,9 +336,7 @@ def test_mmcif_pdb_conversion(): ) assert_frame_equal( pdb.df["HETATM"].drop(columns=["line_idx"]), - mmcif_pdb.df["HETATM"] - .drop(columns=["line_idx"]) - .reset_index(drop=True), + mmcif_pdb.df["HETATM"].drop(columns=["line_idx"]).reset_index(drop=True), ) # single chain test @@ -352,7 +350,5 @@ def test_mmcif_pdb_conversion(): ) assert_frame_equal( pdb.df["HETATM"].drop(columns=["line_idx"]), - mmcif_pdb.df["HETATM"] - .drop(columns=["line_idx"]) - .reset_index(drop=True), + mmcif_pdb.df["HETATM"].drop(columns=["line_idx"]).reset_index(drop=True), ) diff --git a/tests/mmtf/test_write_mmtf.py b/tests/mmtf/test_write_mmtf.py index f516f6c..0aa930b 100644 --- a/tests/mmtf/test_write_mmtf.py +++ b/tests/mmtf/test_write_mmtf.py @@ -20,7 +20,6 @@ def test_write_mmtf_bp(): "1rcf", ] for pdb in PDB_CODES: - print(pdb) pm1 = PandasMmtf().fetch_mmtf(pdb) pm1.to_mmtf("test.mmtf") assert os.path.exists("test.mmtf") @@ -51,7 +50,6 @@ def test_write_mmtf(): "1rcf", ] for pdb in PDB_CODES: - print(pdb) pm1 = PandasMmtf().fetch_mmtf(pdb) write_mmtf(pd.concat([pm1.df["ATOM"], pm1.df["HETATM"]]), "test.mmtf") assert os.path.exists("test.mmtf") diff --git a/tests/pdb/test_amino3to1.py b/tests/pdb/test_amino3to1.py index 276e2e3..4691906 100644 --- a/tests/pdb/test_amino3to1.py +++ b/tests/pdb/test_amino3to1.py @@ -159,7 +159,6 @@ def test_sameindex(): TESTDATA_1t48 = str(TEST_DATA.joinpath("1t48_995.pdb")) p1t48 = PandasPdb() p1t48.read_pdb(TESTDATA_1t48) - print(p1t48) p1t48.df["ATOM"].index = np.zeros(p1t48.df["ATOM"].shape[0], dtype=int) expect_res = [ @@ -490,12 +489,8 @@ def test_multichain(): expect_chain = ["A" for _ in range(88)] + ["B" for _ in range(94)] got_chain = list(transl["chain_id"].values) - got_res_a = list( - transl.loc[transl["chain_id"] == "A", "residue_name"].values - ) - got_res_b = list( - transl.loc[transl["chain_id"] == "B", "residue_name"].values - ) + got_res_a = list(transl.loc[transl["chain_id"] == "A", "residue_name"].values) + got_res_b = list(transl.loc[transl["chain_id"] == "B", "residue_name"].values) assert expect_chain == got_chain assert expect_res_a == got_res_a diff --git a/tests/pdb/test_read_pdb.py b/tests/pdb/test_read_pdb.py index abb5cdc..4462051 100644 --- a/tests/pdb/test_read_pdb.py +++ b/tests/pdb/test_read_pdb.py @@ -11,6 +11,7 @@ import importlib.resources as pkg_resources else: import importlib_resources as pkg_resources + from urllib.error import HTTPError import numpy as np @@ -94,8 +95,7 @@ def test__read_pdb(): """Test private _read_pdb""" ppdb = PandasPdb() - path, txt = ppdb._read_pdb(TESTDATA_FILENAME) - print(txt) + _, txt = ppdb._read_pdb(TESTDATA_FILENAME) assert txt == three_eiy @@ -104,8 +104,7 @@ def test__read_pdb_raises(): Test if ValueError is raised for wrong file formats.""" expect = ( - "Wrong file format; allowed file formats are " - ".pdb, .pdb.gz, .ent, .ent.gz" + "Wrong file format; allowed file formats are " ".pdb, .pdb.gz, .ent, .ent.gz" ) def run_code_1():