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
75627f3d
Commit
75627f3d
authored
Jul 26, 2017
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for configurable alphabet
parent
f8d4a5af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
test/test_list_command.py
test/test_list_command.py
+42
-0
test/test_list_format.py
test/test_list_format.py
+8
-0
No files found.
test/test_list_command.py
View file @
75627f3d
...
@@ -434,6 +434,48 @@ class ListCommandTest(CommandTest):
...
@@ -434,6 +434,48 @@ class ListCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
'|2| This item is visible
\
n
'
)
self
.
assertEqual
(
self
.
output
,
'|2| This item is visible
\
n
'
)
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_list50
(
self
):
"""
Fallback to normal alphabet for too short alphabets, fallback on
default alphabet.
"""
config
(
p_overrides
=
{(
'topydo'
,
'identifier_alphabet'
):
'a'
,
(
'topydo'
,
'identifiers'
):
'text'
})
# self.todolist was loaded with old identifier settings
todolist
=
load_file_to_todolist
(
"test/data/ListCommandTest.txt"
)
command
=
ListCommand
([
"-F"
,
"%I"
,
"Foo"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
"t5c
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
''
)
def
test_list51
(
self
):
""" Test hexadecimal IDs """
config
(
p_overrides
=
{(
'topydo'
,
'identifier_alphabet'
):
'0123456789abcdef'
,
(
'topydo'
,
'identifiers'
):
'text'
})
# self.todolist was loaded with old identifier settings
todolist
=
load_file_to_todolist
(
"test/data/ListCommandTest.txt"
)
command
=
ListCommand
([
"-F"
,
"%i"
,
"Foo"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
'2c8
\
n
'
)
self
.
assertEqual
(
self
.
errors
,
''
)
def
test_list52
(
self
):
""" Alphabet is too short due to duplicate characters """
config
(
p_overrides
=
{(
'topydo'
,
'identifier_alphabet'
):
'0123456788'
,
(
'topydo'
,
'identifiers'
):
'text'
})
# self.todolist was loaded with old identifier settings
todolist
=
load_file_to_todolist
(
"test/data/ListCommandTest.txt"
)
command
=
ListCommand
([
"-F"
,
"%i"
,
"Foo"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
't5c
\
n
'
)
self
.
assertEqual
(
self
.
errors
,
''
)
def
test_list_name
(
self
):
def
test_list_name
(
self
):
name
=
ListCommand
.
name
()
name
=
ListCommand
.
name
()
...
...
test/test_list_format.py
View file @
75627f3d
...
@@ -23,6 +23,7 @@ from test.command_testcase import CommandTest
...
@@ -23,6 +23,7 @@ from test.command_testcase import CommandTest
from
test.facilities
import
load_file_to_todolist
from
test.facilities
import
load_file_to_todolist
from
topydo.commands.ListCommand
import
ListCommand
from
topydo.commands.ListCommand
import
ListCommand
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
from
topydo.lib.TodoListBase
import
TodoListBase
# We're searching for 'mock'
# We're searching for 'mock'
# 'mock' was added as 'unittest.mock' in Python 3.3, but PyPy 3 is based on Python 3.2
# 'mock' was added as 'unittest.mock' in Python 3.3, but PyPy 3 is based on Python 3.2
...
@@ -763,5 +764,12 @@ x 2014-12-12 Completed but with date:2014-12-12
...
@@ -763,5 +764,12 @@ x 2014-12-12 Completed but with date:2014-12-12
self.assertEqual(self.output, result)
self.assertEqual(self.output, result)
self.assertEqual(self.errors, "")
self.assertEqual(self.errors, "")
def test_list_format52(self):
config(p_overrides={('
topydo
', '
identifier_alphabet
'): '
0123456789
abcdef
', ('
topydo
', '
identifiers
'): '
text
'})
# make sure that it fallbacks to the default alphabet
todolist = TodoListBase([str(i) for i in range(0, 100 * 16 * 10)])
self.assertEqual(4, todolist.max_id_length())
if __name__ == '
__main__
':
if __name__ == '
__main__
':
unittest.main()
unittest.main()
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