Esempio n. 1
0
class TestObjectListStore(unittest.TestCase):
    def setUp(self):
        self.model = _DummyParent()
        prop = type(self.model).attrib
        self.store = ObjectListStore(self.model, prop)

    def tearDown(self):
        super(TestObjectListStore, self).tearDown()
        del self.model

    def test_columns(self):
        self.assertEqual(self.store.get_n_columns(),
                         len(_DummyObject.Meta.get_column_properties()))
        self.assertEqual(self.store.get_column_type(self.store.c_name),
                         GObject.type_from_name("gchararray"))
        self.assertEqual(self.store.get_column_type(self.store.c_number),
                         GObject.type_from_name("gdouble"))
        self.assertEqual(self.store.get_column_type(self.store.c_test),
                         GObject.type_from_name("PyObject"))

    def test_convert(self):
        self.assertEqual(self.store.convert(self.store.c_number, "0.5"), 0.5)

    # TODO:
    # - test JSON serialisation
    # - test raw data

    pass  # end of class
class TestObjectListStore(unittest.TestCase):

    def setUp(self):
        self.model = _DummyParent()
        prop = self.model.Meta.get_prop_intel_by_name("attrib")
        self.store = ObjectListStore(self.model, prop)

    def tearDown(self):
        super(TestObjectListStore, self).tearDown()
        del self.model

    def test_columns(self):
        self.assertEqual(self.store.get_n_columns(), len(_DummyObject.Meta.get_column_properties()))
        self.assertEqual(self.store.get_column_type(self.store.c_name), gobject.type_from_name("gchararray"))
        self.assertEqual(self.store.get_column_type(self.store.c_number), gobject.type_from_name("gdouble"))
        self.assertEqual(self.store.get_column_type(self.store.c_test), gobject.type_from_name("PyObject"))

    def test_convert(self):
        self.assertEqual(self.store.convert(1, "0.5"), 0.5)

    # TODO:
    # - test JSON serialisation
    # - test raw data

    pass # end of class
Esempio n. 3
0
 def setUp(self):
     self.model = _DummyParent()
     prop = type(self.model).attrib
     self.store = ObjectListStore(self.model, prop)
Esempio n. 4
0
 def setUp(self):
     self.model = _DummyParent()
     prop = self.model.Meta.get_prop_intel_by_name("attrib")
     self.store = ObjectListStore(self.model, prop)