Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
7b4ccc57
Commit
7b4ccc57
authored
Jan 15, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global prompt functions instead of (re)defining lambdas all the time.
parent
6466320c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
test/DeleteCommandTest.py
test/DeleteCommandTest.py
+12
-6
No files found.
test/DeleteCommandTest.py
View file @
7b4ccc57
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
# Copyright (C) 2014
- 2015
Bram Schoenmakers <me@bramschoenmakers.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -20,6 +20,12 @@ from topydo.lib.DeleteCommand import DeleteCommand
from
topydo.lib.TodoList
import
TodoList
from
topydo.lib.TodoListBase
import
InvalidTodoException
def
_yes_prompt
(
self
):
return
"y"
def
_no_prompt
(
self
):
return
"n"
class
DeleteCommandTest
(
CommandTest
.
CommandTest
):
def
setUp
(
self
):
super
(
DeleteCommandTest
,
self
).
setUp
()
...
...
@@ -31,7 +37,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
todolist
=
TodoList
(
todos
)
def
test_del1
(
self
):
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
lambda
p
:
"n"
)
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_no_prompt
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
...
...
@@ -40,7 +46,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_del1_regex
(
self
):
command
=
DeleteCommand
([
"Foo"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
lambda
p
:
"n"
)
command
=
DeleteCommand
([
"Foo"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_no_prompt
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
...
...
@@ -49,7 +55,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_del2
(
self
):
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
lambda
p
:
"y"
)
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
...
...
@@ -58,7 +64,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_del3
(
self
):
command
=
DeleteCommand
([
"-f"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
lambda
p
:
"y"
)
command
=
DeleteCommand
([
"-f"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
...
...
@@ -67,7 +73,7 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_del4
(
self
):
command
=
DeleteCommand
([
"--force"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
lambda
p
:
"y"
)
command
=
DeleteCommand
([
"--force"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment