本文整理汇总了Python中card.Card.addLine方法的典型用法代码示例。如果您正苦于以下问题:Python Card.addLine方法的具体用法?Python Card.addLine怎么用?Python Card.addLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.addLine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_card_lines
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def test_card_lines(self):
c = Card("atomic_positions")
c.addLine(" Ni 0.00 0.00 0.00 ")
self.assertEqual(c.line(0), "Ni 0.00 0.00 0.00") # should strip side spaces
c.addLine(" Ni 0.50 0.50 0.50 ")
self.assertEqual(len(c.lines()), 2)
示例2: test_card_tostring
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def test_card_tostring(self):
c = Card("atomic_positions")
c.addLine(" Ni 0.00 0.00 0.00 ")
self.assertEqual(c.toString(), fixtures.assertC_no_arg)
c.setArg("alat")
self.assertEqual(c.toString(indent=3), fixtures.assertC_arg)
示例3: _convertCards
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def _convertCards(self, cards):
for cname in cards.keys():
c = Card(cname)
c.setArg(cards[cname]["args"])
for l in cards[cname]["values"]:
c.addLine(l)
self.cards[cname] = c
示例4: test_card_remove_lines
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def test_card_remove_lines(self):
c = Card("atomic_positions")
c.addLine(" Ni 0.00 0.00 0.00 ")
c.addLine(" Ni 0.50 0.50 0.50 ")
c.removeLine(0)
self.assertEqual(c.line(0), "Ni 0.50 0.50 0.50")
c.editLines(["a", "b"])
self.assertEqual(c.lines(), ["a", "b"])
示例5: test_qeinput_card
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def test_qeinput_card(self):
input = QEInput()
c = Card("atomic_species")
c.setArg("temp")
c.addLine("Ni 26.98 Ni.pbe-nd-rrkjus.UPF")
input.addCard(c)
c2 = input.card("atomic_positions")
self.assertEqual(input.toString(), fixtures.assertNewCard)
input.removeCard("atomic_species")
self.assertEqual(input.toString(), fixtures.assertNewCard2)
示例6: testCreateConfig
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import addLine [as 别名]
def testCreateConfig():
print "Testing creation of config file"
qe = QEInput()
nl = Namelist('control')
nl.add('title', "'Ni'")
nl.add('restart_mode', "'from_scratch'")
print "Adding parameters to namelist:\n%s" % nl.toString()
nl.set('title', "'Fe'")
qe.addNamelist(nl)
print "Adding namelist to QEInput:\n%s" % qe.toString()
c = Card('atomic_species')
c.addLine('Ni 26.98 Ni.pbe-nd-rrkjus.UPF')
print "Adding line to card:\n%s" % c.toString()
qe.addCard(c)
print "Adding card to QEInput:\n%s" % qe.toString()