Example #1
0
    def test_semantic_types(self):
        types = self.pm.semantic_types

        exp = {
            'IntSequence1':
            SemanticTypeRecord(semantic_type=IntSequence1, plugin=self.plugin),
            'IntSequence2':
            SemanticTypeRecord(semantic_type=IntSequence2, plugin=self.plugin),
            'Mapping':
            SemanticTypeRecord(semantic_type=Mapping, plugin=self.plugin),
            'FourInts':
            SemanticTypeRecord(semantic_type=FourInts, plugin=self.plugin),
            'Kennel':
            SemanticTypeRecord(semantic_type=Kennel, plugin=self.plugin),
            'Dog':
            SemanticTypeRecord(semantic_type=Dog, plugin=self.plugin),
            'Cat':
            SemanticTypeRecord(semantic_type=Cat, plugin=self.plugin),
            'SingleInt':
            SemanticTypeRecord(semantic_type=SingleInt, plugin=self.plugin)
        }

        self.assertEqual(types, exp)
    def test_get_semantic_types(self):
        types = self.pm.get_semantic_types()

        exp = {
            'IntSequence1':
            SemanticTypeRecord(semantic_type=IntSequence1, plugin=self.plugin),
            'IntSequence2':
            SemanticTypeRecord(semantic_type=IntSequence2, plugin=self.plugin),
            'Mapping':
            SemanticTypeRecord(semantic_type=Mapping, plugin=self.plugin),
            'FourInts':
            SemanticTypeRecord(semantic_type=FourInts, plugin=self.plugin),
            'Kennel[Dog]':
            SemanticTypeRecord(semantic_type=Kennel[Dog], plugin=self.plugin),
            'Kennel[Cat]':
            SemanticTypeRecord(semantic_type=Kennel[Cat], plugin=self.plugin),
            'SingleInt':
            SemanticTypeRecord(semantic_type=SingleInt, plugin=self.plugin)
        }

        self.assertLessEqual(exp.keys(), types.keys())
        self.assertNotIn(Cat, types)
        self.assertNotIn(Dog, types)
        self.assertNotIn(Kennel, types)
    def test_type_fragments(self):
        types = self.pm.type_fragments

        exp = {
            'IntSequence1':
            SemanticTypeRecord(semantic_type=IntSequence1, plugin=self.plugin),
            'IntSequence2':
            SemanticTypeRecord(semantic_type=IntSequence2, plugin=self.plugin),
            'IntSequence3':
            SemanticTypeRecord(semantic_type=IntSequence3, plugin=self.plugin),
            'Mapping':
            SemanticTypeRecord(semantic_type=Mapping, plugin=self.plugin),
            'FourInts':
            SemanticTypeRecord(semantic_type=FourInts, plugin=self.plugin),
            'Kennel':
            SemanticTypeRecord(semantic_type=Kennel, plugin=self.plugin),
            'Dog':
            SemanticTypeRecord(semantic_type=Dog, plugin=self.plugin),
            'Cat':
            SemanticTypeRecord(semantic_type=Cat, plugin=self.plugin),
            'SingleInt':
            SemanticTypeRecord(semantic_type=SingleInt, plugin=self.plugin),
            'C1':
            SemanticTypeRecord(semantic_type=C1, plugin=self.plugin),
            'C2':
            SemanticTypeRecord(semantic_type=C2, plugin=self.plugin),
            'C3':
            SemanticTypeRecord(semantic_type=C3, plugin=self.plugin),
            'Foo':
            SemanticTypeRecord(semantic_type=Foo, plugin=self.plugin),
            'Bar':
            SemanticTypeRecord(semantic_type=Bar, plugin=self.plugin),
            'Baz':
            SemanticTypeRecord(semantic_type=Baz, plugin=self.plugin)
        }

        self.assertEqual(types, exp)