Skip to content

Commit

Permalink
style: apply Black
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalinDe committed Mar 29, 2024
1 parent 44b79ca commit a1ff400
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
18 changes: 8 additions & 10 deletions pusteblume/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def pprinted_short(self):
:returns: pretty-printed short form
:rtype: str
"""
return f"{pusteblume.output.colour_string(self.name, fg='green')}{self.pprinted_tags}" # noqa: E501
return f"{pusteblume.output.colour_string(self.name, fg='green')}{self.pprinted_tags}" # noqa: E501

@property
def pprinted_time_range(self):
Expand Down Expand Up @@ -254,9 +254,9 @@ def _get_task(config, name, tags):
:rtype: generator
"""
for task_id, start_time, end_time in _execute(
config,
"SELECT id,start_time,end_time FROM task WHERE name = ?",
(name,),
config,
"SELECT id,start_time,end_time FROM task WHERE name = ?",
(name,),
):
if tuple(name for (name, _) in _get_related_tags(config, task_id)) == tags:
yield (
Expand Down Expand Up @@ -410,10 +410,7 @@ def _select(config, prompt, choices):
os.linesep.join(
(
prompt,
*(
f"{i}. {choice}"
for (i, choice) in enum_choices
),
*(f"{i}. {choice}" for (i, choice) in enum_choices),
),
),
),
Expand Down Expand Up @@ -441,7 +438,8 @@ def edit(config, name=None, tags=tuple()):
config,
"choose task to edit: …",
(task.pprinted_medium for _, task in tasks),
) - 1
)
- 1
]
else:
task_id, task = tasks[0]
Expand All @@ -458,7 +456,7 @@ def edit(config, name=None, tags=tuple()):
)
print(Task(parsed_input.name, tags, (None, None)).pprinted_short)
if attr == "tag":
for (tag_name, tag_id) in _get_related_tags(config, task_id):
for tag_name, tag_id in _get_related_tags(config, task_id):
if tag_name not in parsed_input.tag:
_execute(config, "DELETE FROM added_to WHERE tag_id = ?", (tag_id,))
for tag in parsed_input.tag:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_invalid_name(self):
pusteblume.cli.name(pusteblume.cli._RESERVED_CHARS)
self.assertEqual(
str(exception),
f"'{pusteblume.cli._RESERVED_CHARS}' contains reserved characters'{pusteblume.cli._RESERVED_CHARS}'", # noqa: E501
f"'{pusteblume.cli._RESERVED_CHARS}' contains reserved characters'{pusteblume.cli._RESERVED_CHARS}'", # noqa: E501
)

def test_valid_tag(self):
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_invalid_tag(self):
pusteblume.cli.tag(f"[{pusteblume.cli._RESERVED_CHARS}]")
self.assertEqual(
str(exception),
f"'{pusteblume.cli._RESERVED_CHARS}' contains reserved characters'{pusteblume.cli._RESERVED_CHARS}'", # noqa: E501
f"'{pusteblume.cli._RESERVED_CHARS}' contains reserved characters'{pusteblume.cli._RESERVED_CHARS}'", # noqa: E501
)


Expand Down
14 changes: 11 additions & 3 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def test_edit_no_task(self):
"""
self.assertEqual(
pusteblume.tasks.edit(self.config, name=self.name, tags=self.tags),
f"no task '{pusteblume.tasks.Task(self.name, self.tags, (None, None)).pprinted_short}'", # noqa: E501
f"no task '{pusteblume.tasks.Task(self.name, self.tags, (None, None)).pprinted_short}'", # noqa: E501
)

@patch(
Expand Down Expand Up @@ -424,14 +424,22 @@ def test_edit_tags(self, mock_input):
"""
task_id = self._insert_task(
self.name,
("pusteblume", "v1.2", "test cases",),
(
"pusteblume",
"v1.2",
"test cases",
),
self.start_time,
None,
)
pusteblume.tasks.edit(
self.config,
self.name,
("pusteblume", "v1.2", "test cases",),
(
"pusteblume",
"v1.2",
"test cases",
),
)
self.assertEqual(
pusteblume.tasks._execute(
Expand Down

0 comments on commit a1ff400

Please sign in to comment.