From 84b4ab1e1b25d935ac6029ce523ae50743fe379c Mon Sep 17 00:00:00 2001 From: Liz Gehret Date: Tue, 4 Jun 2024 10:59:51 -0700 Subject: [PATCH] TST: fixing test failures from python 3.9 update --- rescript/cross_validate.py | 2 +- rescript/evaluate.py | 2 +- rescript/tests/test_cross_validate.py | 6 +++--- rescript/tests/test_derep.py | 2 +- rescript/tests/test_evaluate.py | 2 +- rescript/tests/test_filter_length.py | 2 +- rescript/tests/test_merge.py | 2 +- rescript/types/tests/test_types_formats_transformers.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rescript/cross_validate.py b/rescript/cross_validate.py index 2e6e3625..b6d2cdfe 100644 --- a/rescript/cross_validate.py +++ b/rescript/cross_validate.py @@ -31,7 +31,7 @@ def evaluate_fit_classifier(ctx, # Validate inputs start = timeit.default_timer() taxa, seq_ids = _validate_cross_validate_inputs(taxonomy, sequences) - taxa = taxa.loc[seq_ids] + taxa = taxa.loc[list(seq_ids)] taxonomy = q2.Artifact.import_data('FeatureData[Taxonomy]', taxa) new_time = _check_time(start, 'Validation') diff --git a/rescript/evaluate.py b/rescript/evaluate.py index 3f6475eb..b54202dc 100644 --- a/rescript/evaluate.py +++ b/rescript/evaluate.py @@ -260,7 +260,7 @@ def _plot_eval_seqs(results, lengths, palette): def _visualize(output_dir, results, plot): - pd.set_option('display.max_colwidth', -1) + pd.set_option('display.max_colwidth', None) # save results results.to_csv(join(output_dir, 'evaluate_seqs_results.tsv'), sep='\t') diff --git a/rescript/tests/test_cross_validate.py b/rescript/tests/test_cross_validate.py index 86a3f5c8..1c855759 100644 --- a/rescript/tests/test_cross_validate.py +++ b/rescript/tests/test_cross_validate.py @@ -12,7 +12,7 @@ from qiime2.plugins import rescript import qiime2 import pandas as pd -import pandas.util.testing as pdt +import pandas.testing as pdt from rescript import cross_validate @@ -28,8 +28,8 @@ def setUp(self): # drop feature C1b because it is missing species level self.taxa_series = pd.read_csv( - self.get_data_path('derep-taxa.tsv'), sep='\t', index_col=0, - squeeze=True).drop('C1b') + self.get_data_path('derep-taxa.tsv'), + sep='\t', index_col=0).squeeze('columns').drop('C1b') self.taxa = import_data('FeatureData[Taxonomy]', self.taxa_series) seqs = import_data( 'FeatureData[Sequence]', self.get_data_path('derep-test.fasta')) diff --git a/rescript/tests/test_derep.py b/rescript/tests/test_derep.py index 95fbfa9d..27ef018f 100644 --- a/rescript/tests/test_derep.py +++ b/rescript/tests/test_derep.py @@ -10,7 +10,7 @@ from qiime2.plugins import rescript import qiime2 import pandas as pd -import pandas.util.testing as pdt +import pandas.testing as pdt from rescript.dereplicate import _backfill_taxonomy from rescript._utilities import _return_stripped_taxon_rank_list diff --git a/rescript/tests/test_evaluate.py b/rescript/tests/test_evaluate.py index abe7e67b..6bad4ff0 100644 --- a/rescript/tests/test_evaluate.py +++ b/rescript/tests/test_evaluate.py @@ -11,7 +11,7 @@ import qiime2 import pandas as pd import numpy as np -import pandas.util.testing as pdt +import pandas.testing as pdt from q2_types.feature_data import DNAIterator from rescript import evaluate diff --git a/rescript/tests/test_filter_length.py b/rescript/tests/test_filter_length.py index f151ac9d..e3d292b4 100644 --- a/rescript/tests/test_filter_length.py +++ b/rescript/tests/test_filter_length.py @@ -9,7 +9,7 @@ import pandas as pd import qiime2 -import pandas.util.testing as pdt +import pandas.testing as pdt from qiime2.plugin.testing import TestPluginBase from q2_types.feature_data import DNAIterator from qiime2.plugins import rescript diff --git a/rescript/tests/test_merge.py b/rescript/tests/test_merge.py index 3d27c333..ebf184a7 100644 --- a/rescript/tests/test_merge.py +++ b/rescript/tests/test_merge.py @@ -11,7 +11,7 @@ import qiime2 import pandas as pd import numpy as np -import pandas.util.testing as pdt +import pandas.testing as pdt import_data = qiime2.Artifact.import_data diff --git a/rescript/types/tests/test_types_formats_transformers.py b/rescript/types/tests/test_types_formats_transformers.py index 40befabc..bd496161 100644 --- a/rescript/types/tests/test_types_formats_transformers.py +++ b/rescript/types/tests/test_types_formats_transformers.py @@ -7,7 +7,7 @@ # ---------------------------------------------------------------------------- import os import pandas as pd -import pandas.util.testing as pdt +import pandas.testing as pdt import numpy as np import tempfile import pkg_resources