From 51112f1e6d91fea450882a86457af3016a3f3ec2 Mon Sep 17 00:00:00 2001 From: Jordan Woods <13803242+jorwoods@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:11:06 -0500 Subject: [PATCH 1/3] fix: str/repr for BackgroundJobItem --- tableauserverclient/models/job_item.py | 2 +- test/test_job.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tableauserverclient/models/job_item.py b/tableauserverclient/models/job_item.py index 9933d7f2..12d025be 100644 --- a/tableauserverclient/models/job_item.py +++ b/tableauserverclient/models/job_item.py @@ -222,7 +222,7 @@ def __init__( self._subtitle = subtitle def __str__(self): - return f"<{self.__class__.name} {self._id} {self._type}>" + return f"<{self.__class__.__qualname__} {self._id} {self._type}>" def __repr__(self): return self.__str__() + " { " + ", ".join(" % s: % s" % item for item in vars(self).items()) + "}" diff --git a/test/test_job.py b/test/test_job.py index 8e248882..d8639708 100644 --- a/test/test_job.py +++ b/test/test_job.py @@ -136,3 +136,11 @@ def test_get_job_datasource_name(self) -> None: m.get(f"{self.baseurl}/{job_id}", text=response_xml) job = self.server.jobs.get_by_id(job_id) self.assertEqual(job.datasource_name, "World Indicators") + + def test_background_job_str(self) -> None: + job = TSC.BackgroundJobItem( + "ee8c6e70-43b6-11e6-af4f-f7b0d8e20760", datetime.now(), 1, "extractRefresh", "Failed" + ) + assert not str(job).startswith("< Date: Thu, 11 Jul 2024 21:24:23 -0500 Subject: [PATCH 2/3] chore: jobs_endpoint absolute imports --- tableauserverclient/server/endpoint/jobs_endpoint.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tableauserverclient/server/endpoint/jobs_endpoint.py b/tableauserverclient/server/endpoint/jobs_endpoint.py index a48a3244..b9ac2492 100644 --- a/tableauserverclient/server/endpoint/jobs_endpoint.py +++ b/tableauserverclient/server/endpoint/jobs_endpoint.py @@ -1,11 +1,11 @@ import logging -from tableauserverclient.server.query import QuerySet -from .endpoint import QuerysetEndpoint, api -from .exceptions import JobCancelledException, JobFailedException from tableauserverclient.models import JobItem, BackgroundJobItem, PaginationItem -from ..request_options import RequestOptionsBase +from tableauserverclient.server.endpoint.endpoint import QuerysetEndpoint, api +from tableauserverclient.server.endpoint.exceptions import JobCancelledException, JobFailedException +from tableauserverclient.server.query import QuerySet +from tableauserverclient.server.request_options import RequestOptionsBase from tableauserverclient.exponential_backoff import ExponentialBackoffTimer from tableauserverclient.helpers.logging import logger From 3c3c5b30d8c6b89793bd3a5c69fd67c16c4ebeb0 Mon Sep 17 00:00:00 2001 From: Jordan Woods <13803242+jorwoods@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:34:32 -0500 Subject: [PATCH 3/3] chore: absolute imports for jobitem --- tableauserverclient/models/job_item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tableauserverclient/models/job_item.py b/tableauserverclient/models/job_item.py index 12d025be..155ce668 100644 --- a/tableauserverclient/models/job_item.py +++ b/tableauserverclient/models/job_item.py @@ -4,7 +4,7 @@ from defusedxml.ElementTree import fromstring from tableauserverclient.datetime_helpers import parse_datetime -from .flow_run_item import FlowRunItem +from tableauserverclient.models.flow_run_item import FlowRunItem class JobItem(object):