Ejemplo n.º 1
0
    def test_main(self):
        fndb1, ret1 = trace(main1, [], trace_all=True)
        fndb2, ret2 = trace(main2, [], trace_all=True)

        print(diff_db(fndb1, fndb2))

        self.assertEqual(len(fndb1), main1_fn_count)
        self.assertEqual(len(fndb2), main2_fn_count)
        self.assertEqual(list(fndb1.keys()), list(fndb2.keys()))
        self.assertNotEqual(fndb1, fndb2)
Ejemplo n.º 2
0
    def test_main(self):
        fndb1, ret1 = trace(main1, [], trace_all=True)
        fndb2, ret2 = trace(main2, [], trace_all=True)

        print(diff_db(fndb1, fndb2))

        self.assertEqual(len(fndb1), main1_fn_count)
        self.assertEqual(len(fndb2), main2_fn_count)
        self.assertEqual(list(fndb1.keys()), list(fndb2.keys()))
        self.assertNotEqual(fndb1, fndb2)
Ejemplo n.º 3
0
 def test_exception(self):
     fndbe, ret = trace(main_exc, [], trace_all=True)
     dumpe = format_db(fndbe)
     print(dumpe)
     self.assertEqual(len(fndbe), main_exc_fn_count)
     self.assertTrue(
         any('ValueError' in line and 'Catch this error' in line
             for line in dumpe.splitlines()))
Ejemplo n.º 4
0
 def test_exception(self):
     fndbe, ret = trace(main_exc, [], trace_all=True)
     dumpe = format_db(fndbe)
     print(dumpe)
     self.assertEqual(len(fndbe), main_exc_fn_count)
     self.assertTrue(any(
         'ValueError' in line and 'Catch this error' in line
         for line in dumpe.splitlines()))
Ejemplo n.º 5
0
    def test_dump_and_load(self):
        fndb, ret = trace(main1, [], trace_all=True)
        self.assertEqual(len(fndb), main1_fn_count)

        store = freeze_db(fndb)
        dump = format_db(store)
        dump_direct = format_db(fndb)
        self.assertEqual(dump, dump_direct)

        loaded = load_db(dump)
        self.assertDictEqual(loaded, store)
Ejemplo n.º 6
0
 def test_dump(self):
     fndb1, ret = trace(main1, [], trace_all=True)
     dump1 = format_db(fndb1)
     print(dump1)
     self.assertEqual(len(fndb1), main1_fn_count)
Ejemplo n.º 7
0
 def test_dump(self):
     fndb1, ret = trace(main1, [], trace_all=True)
     dump1 = format_db(fndb1)
     print(dump1)
     self.assertEqual(len(fndb1), main1_fn_count)