Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vsamoilov committed Nov 1, 2023
1 parent e16caf5 commit 53b55cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion databricks/sdk/dbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def get(self, taskKey: str, key: str, default: any = None, debugValue: any = Non
Returns `debugValue` if present, throws an error otherwise as this implementation is always run outside of a job run
"""
if debugValue is None:
raise ValueError('No debug value set for task value, when outside of job run')
raise TypeError(
'Must pass debugValue when calling get outside of a job context. debugValue cannot be None.'
)
return debugValue

def set(self, key: str, value: any) -> None:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_dbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,14 @@ def test_jobs_task_values_get(dbutils):

dbutils.jobs.taskValues.set('key', 'value')

# Expect `get` to always return the `debugValue`` when calling outside of a job context and not what was previously set using `set`
assert dbutils.jobs.taskValues.get('taskKey', 'key', debugValue='debug') == 'debug'


def test_jobs_task_values_get_throws(dbutils):
try:
dbutils.jobs.taskValues.get('taskKey', 'key')
assert False
except ValueError as e:
assert str(e) == 'No debug value set for task value, when outside of job run'
except TypeError as e:
assert str(
e) == 'Must pass debugValue when calling get outside of a job context. debugValue cannot be None.'

0 comments on commit 53b55cf

Please sign in to comment.