当前位置: 首页>>代码示例>>Python>>正文


Python Interpreter.do_create_graph方法代码示例

本文整理汇总了Python中Interpreter.do_create_graph方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.do_create_graph方法的具体用法?Python Interpreter.do_create_graph怎么用?Python Interpreter.do_create_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interpreter的用法示例。


在下文中一共展示了Interpreter.do_create_graph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainTests

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import do_create_graph [as 别名]

#.........这里部分代码省略.........

    def test_20(self):
        self.assertIsInstance(self.interpreter.file_handler, IFileHandler)

    def test_21(self):
        self.interpreter.do_backup_database("test.db")
        self.assertTrue(os.path.isfile("test.db"))

    def test_22(self):
        self.interpreter.do_backup_database("test.db")
        self.assertFalse(os.path.isfile("default.db"))

    def test_23(self):
        data = self.interpreter.database.backup_database()
        compare_data = [('e01', 'm', 20, 20, 'Normal', 100, '12-06-17'), ('e02', 'f', 21, 21, 'Underweight', 125, '12-07-17'), ('e03', 'm', 21, 21, 'Overweight', 119, '12-07-17'), ('e04', 'f', 22, 22, 'Normal', 114, '12-08-17'), ('e05', 'm', 21, 21, 'Underweight', 119, '12-07-17'), ('e06', 'f', 22, 22, 'Obesity', 113, '12-08-17'), ('e07', 'm', 21, 21, 'Overweight', 126, '12-07-17'), ('e08', 'f', 22, 22, 'Obesity', 130, '12-08-17'), ('e09', 'm', 21, 21, 'Underweight', 132, '12-07-17'), ('e10', 'f', 21, 21, 'Overweight', 140, '12-07-17'), ('e11', 'm', 22, 22, 'Normal', 149, '12-08-17'), ('e12', 'f', 21, 21, 'Underweight', 144, '12-07-17'), ('e13', 'm', 22, 22, 'Obesity', 147, '12-08-17'), ('e14', 'f', 21, 21, 'Overweight', 167, '12-07-17'), ('e15', 'm', 22, 22, 'Obesity', 159, '12-08-17'), ('e16', 'f', 22, 22, 'Normal', 195, '12-08-17')]
        self.assertTrue(data==compare_data)

    def test_24(self):
        data = self.interpreter.database.backup_database()
        compare_data = [('e01', 'm', 20, 20, 'Normal', 100, '12-06-17'), ('e02', 'f', 21, 21, 'Underweight', 125, '12-07-17'), ('e03', 'm', 21, 21, 'Overweight', 119, '12-07-17'), ('e04', 'f', 22, 22, 'Normal', 114, '12-08-17'), ('e05', 'm', 21, 21, 'Underweight', 119, '12-07-17'), ('e06', 'f', 22, 22, 'Obesity', 113, '12-08-17'), ('e07', 'm', 21, 21, 'Overweight', 126, '12-07-17'), ('e08', 'f', 22, 22, 'Obesity', 130, '12-08-17'), ('e09', 'm', 21, 21, 'Underweight', 132, '12-07-17'), ('e10', 'f', 21, 21, 'Overweight', 140, '12-07-17'), ('e11', 'm', 22, 22, 'Normal', 149, '12-08-17'), ('e12', 'f', 21, 21, 'Underweight', 144, '12-07-17'), ('e13', 'm', 22, 22, 'Obesity', 147, '12-08-17'), ('e14', 'f', 21, 21, 'Overweight', 167, '12-07-17'), ('e15', 'm', 22, 22, 'Obesity', 159, '12-08-17'), ('e16', 'f', 22, 22, 'Normal', 195, '12-08-17')]
        self.assertTrue(data[1]==compare_data[1])

    def test_25(self):
        data = self.interpreter.database.backup_database()
        compare_data = [('e01', 'm', 20, 20, 'Normal', 100, '12-06-17'), ('e02', 'f', 21, 21, 'Underweight', 125, '12-07-17'), ('e03', 'm', 21, 21, 'Overweight', 119, '12-07-17'), ('e04', 'f', 22, 22, 'Normal', 114, '12-08-17'), ('e05', 'm', 21, 21, 'Underweight', 119, '12-07-17'), ('e06', 'f', 22, 22, 'Obesity', 113, '12-08-17'), ('e07', 'm', 21, 21, 'Overweight', 126, '12-07-17'), ('e08', 'f', 22, 22, 'Obesity', 130, '12-08-17'), ('e09', 'm', 21, 21, 'Underweight', 132, '12-07-17'), ('e10', 'f', 21, 21, 'Overweight', 140, '12-07-17'), ('e11', 'm', 22, 22, 'Normal', 149, '12-08-17'), ('e12', 'f', 21, 21, 'Underweight', 144, '12-07-17'), ('e13', 'm', 22, 22, 'Obesity', 147, '12-08-17'), ('e14', 'f', 21, 21, 'Overweight', 167, '12-07-17'), ('e15', 'm', 22, 22, 'Obesity', 159, '12-08-17'), ('e16', 'f', 22, 22, 'Normal', 195, '12-08-17')]
        self.assertFalse(data[1]==compare_data[3])

    def test_26(self):
        data = self.interpreter.database.backup_database()
        compare_data = [('e01', 'm', 20, 20, 'Normal', 100, '12-06-17'), ('e02', 'f', 21, 21, 'Underweight', 125, '12-07-17'), ('e03', 'm', 21, 21, 'Overweight', 119, '12-07-17'), ('e04', 'f', 22, 22, 'Normal', 114, '12-08-17'), ('e05', 'm', 21, 21, 'Underweight', 119, '12-07-17'), ('e06', 'f', 22, 22, 'Obesity', 113, '12-08-17'), ('e07', 'm', 21, 21, 'Overweight', 126, '12-07-17'), ('e08', 'f', 22, 22, 'Obesity', 130, '12-08-17'), ('e09', 'm', 21, 21, 'Underweight', 132, '12-07-17'), ('e10', 'f', 21, 21, 'Overweight', 140, '12-07-17'), ('e11', 'm', 22, 22, 'Normal', 149, '12-08-17'), ('e12', 'f', 21, 21, 'Underweight', 144, '12-07-17'), ('e13', 'm', 22, 22, 'Obesity', 147, '12-08-17'), ('e14', 'f', 21, 21, 'Overweight', 167, '12-07-17'), ('e15', 'm', 22, 22, 'Obesity', 159, '12-08-17'), ('e16', 'f', 22, 22, 'Normal', 195, '12-08-17')]
        self.assertIn(data[5], compare_data)

    def test_27(self):
        self.interpreter.do_create_graph("pie gender")
        self.assertTrue(len(self.interpreter.graphs) == 1)

    def test_28(self):
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.assertTrue(len(self.interpreter.graphs) != 1)

    def test_29(self):
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.assertTrue(len(self.interpreter.graphs) != 1)

    def test_30(self):
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.interpreter.do_create_graph("pie gender")
        self.assertTrue(self.interpreter.graphs[0] != self.interpreter.graphs[1])

    def test_31(self):
        data = [("e53", "m", "88", "20", "Normal", "100", "12-06-17"),
                ("e54", "f", "81", "21", "Underweight", "125", "12-07-17")]
        self.interpreter.database.write_to_database(data)
        self.interpreter.database.commit()
        self.interpreter.database.reset()
        self.interpreter.database.commit()
        data_new = self.interpreter.database.backup_database()
        self.assertTrue(data_new != data)

    def test_32(self):
        data = [("e53", "m", "88", "20", "Normal", "100", "12-06-17"),
开发者ID:strakofski,项目名称:Refactoring-Assignment,代码行数:70,代码来源:UnitTestsKris.py


注:本文中的Interpreter.do_create_graph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。