本文整理汇总了Python中Model.Model.setDelimiter方法的典型用法代码示例。如果您正苦于以下问题:Python Model.setDelimiter方法的具体用法?Python Model.setDelimiter怎么用?Python Model.setDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.Model
的用法示例。
在下文中一共展示了Model.setDelimiter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CSVTest
# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import setDelimiter [as 别名]
class CSVTest(unittest.TestCase):
def setUp(self):
self.model = Model()
def testsetDelimiter(self):
self.model.setDelimiter(",")
self.assertEqual(self.model.delimiter, ",")
def testsetName(self):
self.model.read_csv("data.csv")
self.assertEqual(self.model.name, "data.csv")
def testsetName_None(self):
self.assertRaises(TypeError, self.model.read_csv)
def testsetContent(self):
self.model.setDelimiter(",")
self.model.read_csv("data.csv")
self.assertEqual(
self.model.csv_content, "Year,Make,Model,Length,\n1997,Ford,E350,2.34,\n2000,Mercury,Cougar,2.38,\n"
)
def testsetDelimiter_None(self):
self.assertRaises(TypeError, self.model.setDelimiter)
示例2: loader
# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import setDelimiter [as 别名]
class loader(QMainWindow):
""" CSV-Module Application
Autor: Thomas Stedronsky
:param parent:
"""
def __init__(self, parent=None):
super().__init__(parent)
self.form = view.Ui_MainWindow()
self.form.setupUi(self)
self.model = Model()
self.model.setDelimiter(',')
self.form.pushButton.clicked.connect(self.clicked)
def get_text_line(self):
self.model.csv_file = self.form.lineEdit.text()
def clicked(self):
self.model.csv_content = ''
self.get_text_line()
self.model.read_csv(self.model.csv_file)
self.form.label_2.setText(self.model.name)
self.form.textEdit.setText(self.model.csv_content)