Merge pull request #355 from Arthur-Milchior/correctedNewFieldTest

Correcting a test
This commit is contained in:
Damien Elmes 2019-11-26 08:15:03 +13:00 committed by GitHub
commit 41fdbc8394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -231,6 +231,7 @@ and notes.mid = ? and cards.ord = ?""", m['id'], ord)
##################################################
def newField(self, name):
assert(isinstance(name, str))
f = defaultField.copy()
f['name'] = name
return f

View File

@ -39,8 +39,7 @@ def test_fields():
assert "{{NewFront}}" in m['tmpls'][0]['qfmt']
h = d.models.scmhash(m)
# add a field
f = d.models.newField(m)
f['name'] = "foo"
f = d.models.newField("foo")
d.models.addField(m, f)
assert d.getNote(d.models.nids(m)[0]).fields == ["1", "2", ""]
assert d.models.scmhash(m) != h
@ -57,8 +56,7 @@ def test_fields():
d.models.moveField(m, m['flds'][1], 0)
assert d.getNote(d.models.nids(m)[0]).fields == ["1", ""]
# add another and put in middle
f = d.models.newField(m)
f['name'] = "baz"
f = d.models.newField("baz")
d.models.addField(m, f)
f = d.getNote(d.models.nids(m)[0])
f['baz'] = "2"