forked from Bouke/docx-mailmerge
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor duplicate_id_map to its own class UniqueIdsManager
Tests for UniqueIdsManager Refactor Mailmerge.parts to be more flexible for handling different categories of parts Refactor settings with the new category of parts
- Loading branch information
Showing
7 changed files
with
95 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
|
||
from mailmerge import UniqueIdsManager | ||
|
||
class UniqueIdsManagerTest(unittest.TestCase): | ||
""" | ||
Testing UniqueIdsManager class | ||
""" | ||
|
||
def test_unique_id_manager(self): | ||
""" | ||
Tests if the next record field works | ||
""" | ||
tests = [ | ||
("id", 2, None), | ||
("id", 2, 3), | ||
("id", None, 4), | ||
("footer", 1, None), | ||
("footer", None, 2) | ||
] | ||
id_man = UniqueIdsManager() | ||
|
||
for type_id, obj_id, new_id in tests: | ||
self.assertEqual(id_man.register_id(type_id, obj_id=obj_id), new_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters