コード例 #1
0
 def test_variant_of_field_members(self):
     Bar = SemanticType('Bar')
     Foo = SemanticType('Foo',
                        field_names='foo',
                        field_members={'foo': List[Bar]})
     with self.assertRaisesRegex(TypeError, 'is not a variant'):
         Foo[List[Bar]]
コード例 #2
0
    def test_to_ast_semantic(self):
        Foo = SemanticType('Foo')

        ast = List[Foo].to_ast()
        self.assertEqual(ast['fields'][0], Foo.to_ast())
        self.assertEqual(ast['type'], 'collection')
コード例 #3
0
    def is_concrete(self):
        Foo = SemanticType('Foo')

        self.assertFalse(List[Foo].is_concrete())
        self.assertFalse(Set[Int].is_concrete())
コード例 #4
0
    def test_union_inside_collection(self):
        Foo = SemanticType('Foo')
        Bar = SemanticType('Bar')

        self.assertTrue(List[Foo] <= List[Foo | Bar])
コード例 #5
0
    def test_set_semantic_type(self):
        Foo = SemanticType('Foo')

        self.assertTrue(is_collection_type(Set[Foo]))
        self.assertTrue(is_semantic_type(Set[Foo]))
        self.assertFalse(is_primitive_type(Set[Foo]))
コード例 #6
0
    def test_variant_of_alt(self):
        Foo = SemanticType('Foo', field_names='foo')
        Bar = SemanticType('Bar', variant_of=Foo.field['foo'])

        with self.assertRaisesRegex(TypeError, 'is not a variant'):
            Foo[Set[Bar]]
コード例 #7
0
ファイル: _type.py プロジェクト: misialq/q2-protein-pca
# ----------------------------------------------------------------------------
# Copyright (c) 2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

from q2_types.feature_data import FeatureData
from qiime2.core.type import SemanticType

RankedProteinAlignment = SemanticType('RankedProteinAlignment',
                                      variant_of=FeatureData.field['type'])

PositionMapping = SemanticType('PositionMapping',
                               variant_of=FeatureData.field['type'])
コード例 #8
0
    def test_to_ast_semantic(self):
        Foo = SemanticType('Foo')

        ast = List[Foo].to_ast()
        self.assertEqual(ast['fields'][0], Foo.to_ast())
        self.assertEqual(ast['type'], 'collection')