コード例 #1
0
 def setUp(self):
     self.name1 = 'a container 1'
     self.name2 = 'a container 2'
     self.description1 = 'this is a test 1'
     self.description2 = 'this is a test 2'
     self.cont1 = Container(name=self.name1, description=self.description1)
     self.cont2 = Container(name=self.name2, description=self.description2)
コード例 #2
0
 def test__pretty(self):
     name = 'an object'
     description = 'this is a test'
     obj = Container(name=name, description=description)
     res = pretty(obj)
     targ = "Container with  name: '%s' description: '%s'" % (name,
                                                              description)
     self.assertEqual(res, targ)
コード例 #3
0
    def test__children(self):
        container = Container()
        self.assertEqual(container._single_parent_objects, ())
        self.assertEqual(container._multi_parent_objects, ())

        self.assertEqual(container._single_parent_containers, ())
        self.assertEqual(container._multi_parent_containers, ())

        self.assertEqual(container._parent_objects, ())
        self.assertEqual(container._parent_containers, ())

        self.assertEqual(container._container_child_objects, ())
        self.assertEqual(container._data_child_objects, ())
        self.assertEqual(container._multi_child_objects, ())
        self.assertEqual(container._child_properties, ())

        self.assertEqual(container._repr_pretty_containers, ())

        self.assertEqual(container._single_child_objects, ())

        self.assertEqual(container._container_child_containers, ())
        self.assertEqual(container._data_child_containers, ())
        self.assertEqual(container._single_child_containers, ())
        self.assertEqual(container._multi_child_containers, ())

        self.assertEqual(container._child_objects, ())
        self.assertEqual(container._child_containers, ())

        self.assertEqual(container._multi_children, ())
        self.assertEqual(container._single_children, ())
        self.assertEqual(container.data_children, ())
        self.assertEqual(container.container_children, ())
        self.assertEqual(container.children, ())
        self.assertEqual(container.parents, ())

        self.assertEqual(container.data_children_recur, ())
        self.assertEqual(container.container_children_recur, ())
        self.assertEqual(container.children_recur, ())

        self.assertEqual(container.filter(test=1), [])
        self.assertEqual(container.filter(data=True, container=False, test=1),
                         [])
        self.assertEqual(container.filter(data=False, container=False, test=1),
                         [])
        self.assertEqual(container.filter(data=True, container=True, test=1),
                         [])
        self.assertEqual(container.filter(data=False, container=True, test=1),
                         [])

        self.assertEqual(container.size, {})

        container.create_many_to_one_relationship()
        container.create_many_to_many_relationship()
        container.create_relationship()
コード例 #4
0
 def test_init(self):
     '''test to make sure initialization works properly'''
     container = Container(name='a container', description='this is a test')
     self.assertEqual(container.name, 'a container')
     self.assertEqual(container.description, 'this is a test')
     self.assertEqual(container.file_origin, None)
コード例 #5
0
 def test_filter(self):
     container = Container()
     self.assertRaises(TypeError, container.filter, "foo")