Beispiel #1
0
 def setUp(self):
     test_model = SketchupModel()
     test_model.google_id = "test1"
     test_model.tags = ["tag1", "tag2"]
     test_model.title = "title1"
     test_model.text = "Description of 'title1' SketchupModel."
     test_model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()
     test_model.save()
     self.test_model = SketchupModel.find_google_id("test1")
Beispiel #2
0
 def setUp(self):
     test_model = SketchupModel()
     test_model.google_id = "test1"
     test_model.tags = ["tag1", "tag2"]
     test_model.title = "title1"
     test_model.text = "Description of 'title1' SketchupModel."
     test_model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()
     test_model.save()
     self.test_model = SketchupModel.find_google_id("test1")
Beispiel #3
0
    def setUp(self):
        """ Run before starting testing. """
        # TODO : use fixtures
        test_model = SketchupModel()
        test_model.google_id = "test1"
        test_model.tags = ["tag1", "tag2"]
        test_model.title = "title1"
        test_model.text = "Description of 'title1' SketchupModel."
        test_model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()
        test_model.save()

        self.test_model = SketchupModel.find_google_id("test1")
        self.view = PartialView(model=self.test_model, theta=0.0, phi=0.0)
        self.distribution = ShapeDistribution.compute(self.view.pointcloud)
Beispiel #4
0
    def setUp(self):
        """ Run before starting testing. """
        # TODO : use fixtures
        test_model = SketchupModel()
        test_model.google_id = "test1"
        test_model.tags = ["tag1", "tag2"]
        test_model.title = "title1"
        test_model.text = "Description of 'title1' SketchupModel."
        test_model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()
        test_model.save()

        self.test_model = SketchupModel.find_google_id("test1")
        self.view = PartialView(model=self.test_model, theta=0.0, phi=0.0)
        self.distribution = ShapeDistribution.compute(self.view.pointcloud)
Beispiel #5
0
 def test_exception_when_no_existing_category(self):
     """ Test that if the identifier is empty it throws. """
     pointcloud = PointCloud.load_pcd("pointcloud/fixtures/cloud.pcd")
     identifier = Identifier()
     self.assertRaises(IndexError, identifier.identify, pointcloud)
     # training will add a category :
     model = SketchupModel()
     model.google_id = "test1"
     model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()
     identifier.add_models([model], "test_category")
     try:
         identifier.identify(pointcloud)
     except IndexError:
         self.fail("identifier.identify() raised IndexError unexpectedly!")
     except:
         # can raise if Indentification failed
         pass
Beispiel #6
0
    def test_mesh_attribute_can_be_used_as_a_string(self):
        """
        As mesh is store in a gridfsfield, the attribute mesh would
        normally be returned as a GridFSOut object.
        The model has been modified so that it is a string instead.
        """
        model = SketchupModel()
        model.google_id = "test1"
        model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()

        def error_msg(model):
            return "The mesh should be of type str but is {} instead.".format(model.mesh.__class__)

        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring))
        model.save()
        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring))
        model = SketchupModel.find_google_id("test1")
        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring), msg=msg)
Beispiel #7
0
    def test_mesh_attribute_can_be_used_as_a_string(self):
        """
        As mesh is store in a gridfsfield, the attribute mesh would
        normally be returned as a GridFSOut object.
        The model has been modified so that it is a string instead.
        """
        model = SketchupModel()
        model.google_id = "test1"
        model.mesh = file("sketchup_models/fixtures/mesh_can.tri").read()

        def error_msg(model):
            return ("The mesh should be of type str but is {} instead.".
                    format(model.mesh.__class__))

        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring))
        model.save()
        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring))
        model = SketchupModel.find_google_id("test1")
        msg = error_msg(model)
        self.assertTrue(isinstance(model.mesh, basestring), msg=msg)