Do not strip() during dupe check (#171)
This commit is contained in:
parent
2ca35712f3
commit
80d830caed
@ -236,7 +236,7 @@ class AnkiConnect:
|
|||||||
|
|
||||||
# dupeOrEmpty returns if a note is a global duplicate
|
# dupeOrEmpty returns if a note is a global duplicate
|
||||||
# the rest of the function checks to see if the note is a duplicate in the deck
|
# the rest of the function checks to see if the note is a duplicate in the deck
|
||||||
val = note.fields[0].strip()
|
val = note.fields[0]
|
||||||
did = deck['id']
|
did = deck['id']
|
||||||
csum = anki.utils.fieldChecksum(val)
|
csum = anki.utils.fieldChecksum(val)
|
||||||
|
|
||||||
|
23
tests/test_debug.py
Normal file
23
tests/test_debug.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import util
|
||||||
|
|
||||||
|
|
||||||
|
class TestNotes(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
util.invoke('createDeck', deck='test')
|
||||||
|
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
util.invoke('deleteDecks', decks=['test'], cardsToo=True)
|
||||||
|
|
||||||
|
|
||||||
|
def test_bug164(self):
|
||||||
|
note = {'deckName': 'test', 'modelName': 'Basic', 'fields': {'Front': ' Whitespace\n', 'Back': ''}, 'options': { 'allowDuplicate': False, 'duplicateScope': 'deck'}}
|
||||||
|
util.invoke('addNote', note=note)
|
||||||
|
self.assertRaises(Exception, lambda: util.invoke('addNote', note=note))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Reference in New Issue
Block a user