Exemple #1
0
    def test_from_dict_missing_serializer_field(self):
        manifest_deps = {}

        with self.assertRaises(MLIOPackWrongFormat):
            PackManifestSlot.from_dict(
                'nice slot', {
                    'serialized_sha256_hash': 'ahash',
                    'dependencies': ['module-version:themodule-==1.1.0']
                },
                manifest_dependencies=manifest_deps)
Exemple #2
0
    def test_from_dict(self):

        slot = PackManifestSlot.from_dict(
            'nice slot', {
                'serializer': 'generic-ml-models',
                'serialized_sha256_hash': 'ahash',
                'dependencies': ['module-version:themodule-==1.1.0']
            },
            manifest_dependencies=self.manifest_deps_by_id)

        self.assertEqual(slot.slot_key, 'nice slot')
        self.assertIsInstance(slot.serializer, GenericMLModelsSerializer)
        self.assertDictEqual(slot.dependencies, self.manifest_deps_by_id)
        self.assertEqual(slot.pack_object, 'ahash.slot')
        self.assertEqual(slot.serialized_sha256_hash, 'ahash')