Merge pull request #355 from Arthur-Milchior/correctedNewFieldTest
Correcting a test
This commit is contained in:
commit
41fdbc8394
@ -231,6 +231,7 @@ and notes.mid = ? and cards.ord = ?""", m['id'], ord)
|
|||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
def newField(self, name):
|
def newField(self, name):
|
||||||
|
assert(isinstance(name, str))
|
||||||
f = defaultField.copy()
|
f = defaultField.copy()
|
||||||
f['name'] = name
|
f['name'] = name
|
||||||
return f
|
return f
|
||||||
|
@ -39,8 +39,7 @@ def test_fields():
|
|||||||
assert "{{NewFront}}" in m['tmpls'][0]['qfmt']
|
assert "{{NewFront}}" in m['tmpls'][0]['qfmt']
|
||||||
h = d.models.scmhash(m)
|
h = d.models.scmhash(m)
|
||||||
# add a field
|
# add a field
|
||||||
f = d.models.newField(m)
|
f = d.models.newField("foo")
|
||||||
f['name'] = "foo"
|
|
||||||
d.models.addField(m, f)
|
d.models.addField(m, f)
|
||||||
assert d.getNote(d.models.nids(m)[0]).fields == ["1", "2", ""]
|
assert d.getNote(d.models.nids(m)[0]).fields == ["1", "2", ""]
|
||||||
assert d.models.scmhash(m) != h
|
assert d.models.scmhash(m) != h
|
||||||
@ -57,8 +56,7 @@ def test_fields():
|
|||||||
d.models.moveField(m, m['flds'][1], 0)
|
d.models.moveField(m, m['flds'][1], 0)
|
||||||
assert d.getNote(d.models.nids(m)[0]).fields == ["1", ""]
|
assert d.getNote(d.models.nids(m)[0]).fields == ["1", ""]
|
||||||
# add another and put in middle
|
# add another and put in middle
|
||||||
f = d.models.newField(m)
|
f = d.models.newField("baz")
|
||||||
f['name'] = "baz"
|
|
||||||
d.models.addField(m, f)
|
d.models.addField(m, f)
|
||||||
f = d.getNote(d.models.nids(m)[0])
|
f = d.getNote(d.models.nids(m)[0])
|
||||||
f['baz'] = "2"
|
f['baz'] = "2"
|
||||||
|
Loading…
Reference in New Issue
Block a user