當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。