Exemple #1
0
    def test_live_interface_samples(self):
        MLSchema.populate_registry()

        print("Testing Keras")
        loaded_object, errors = MLObject.create_object_from_string(
            SampleSubmissions.FULL_SUBMISSIONS.COMPONENT_KERAS)

        pprint(errors)
        self.assertTrue(len(errors) == 0)
        self.assertIsNotNone(loaded_object.get_schema())

        print("Testing IBM")
        loaded_object, errors = MLObject.create_object_from_string(
            SampleSubmissions.FULL_SUBMISSIONS.COMPONENT_IBM)

        pprint(errors)
        self.assertTrue(len(errors) == 0)
        self.assertIsNotNone(loaded_object.get_schema())

        print("Testing OpenVino")
        loaded_object, errors = MLObject.create_object_from_string(
            SampleSubmissions.FULL_SUBMISSIONS.COMPONENT_OPENVINO)

        pprint(errors)
        self.assertTrue(len(errors) == 0)
        self.assertIsNotNone(loaded_object.get_schema())
Exemple #2
0
    def test_load_object_with_missing_field_from_variable(self):

        WRONG_DATAPATH = """
schema_version: 0.0.1
schema_type: datapath
run_id: 6a9a5931-1c1d-47cc-aaf3-ad8b03f70575
step_id: 0c98f080-4760-46be-b35f-7dbb5e2a88c2
run_date: 1970-01-01 00:00:00.00000
# data_store: I_am_a_datastore_name
storage_connection_type: AWS_BLOB
connection:
    # endpoint: S3://mybucket/puppy.jpg
    access_key_id: AKIAIOSFODNN7EXAMPLE
    secret_access_key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"""

        ml_object, errors = MLObject.create_object_from_string(WRONG_DATAPATH)

        self.assertTrue(ml_object is None)
        self.assertTrue(len(errors) == 2)
        self.assertTrue(errors["data_store"][0] == "Field may not be null.")
        self.assertTrue(errors["connection"]["endpoint"][0] == "Field may not be null.")