Ejemplo n.º 1
0
 def testSilly(self):
     tdf = TicDatFactory(**sillyMeSchema())
     tdf.enable_foreign_key_links()
     oldDat = tdf.freeze_me(tdf.TicDat(**sillyMeData()))
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))
     tdf.opl_prepend = "ooooo"
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))
Ejemplo n.º 2
0
 def testNetflow(self):
     tdf = TicDatFactory(**netflowSchema())
     tdf.enable_foreign_key_links()
     oldDat = tdf.freeze_me(
         tdf.TicDat(
             **
             {t: getattr(netflowData(), t)
              for t in tdf.primary_key_fields}))
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))
     tdf.opl_prepend = "stuff"
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))
Ejemplo n.º 3
0
 def testDiet(self):
     tdf = TicDatFactory(**dietSchema())
     tdf.enable_foreign_key_links()
     oldDat = tdf.TicDat(
         **{t: getattr(dietData(), t)
            for t in tdf.primary_key_fields})
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertFalse(tdf._same_data(oldDat, newDat))
     oldDat.categories["protein"][
         "maxNutrition"] = 12  # Remove infinity from the data
     changedDatStr = create_opl_text(tdf, oldDat)
     changedDat = read_opl_text(tdf, changedDatStr)
     self.assertTrue(tdf._same_data(oldDat, changedDat))
     tdf.opl_prepend = "pre_"
     origStr, changedDatStr = changedDatStr, create_opl_text(tdf, oldDat)
     changedDat = read_opl_text(tdf, changedDatStr)
     self.assertTrue(tdf._same_data(oldDat, changedDat))
     self.assertFalse(origStr == changedDatStr)
Ejemplo n.º 4
0
 def testOther(self):
     tdf = TicDatFactory(table1=[["String_Field"], []],
                         table2=[["String_Field", "Num_PK"],
                                 ["Num_Field_1", "Num_Field_2"]])
     data = {
         "table1": {
             "test1": [],
             "test2": [],
         },
         "table2": {
             ("test1", 1): [2, 3],
             ("test2", 2): [3, 4]
         }
     }
     oldDat = tdf.freeze_me(tdf.TicDat(**data))
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))
     tdf.opl_prepend = "_"
     oldDatStr = create_opl_text(tdf, oldDat)
     newDat = read_opl_text(tdf, oldDatStr)
     self.assertTrue(tdf._same_data(oldDat, newDat))