Exemplo n.º 1
0
class TestNestedModel(Model):

    partition = columns.UUID(primary_key=True, default=uuid4)
    list_list = columns.List(columns.List(columns.Integer), required=False)
    map_list = columns.Map(
        columns.Text,
        columns.List(columns.Text),
        required=False,
    )
    set_tuple = columns.Set(
        columns.Tuple(columns.Integer, columns.Integer),
        required=False,
    )
    def test_instantiation_with_column_class(self):
        """
        Tests that columns instantiated with a column class work properly
        and that the class is instantiated in the constructor

        @since 3.1
        @jira_ticket PYTHON-478
        @expected_result types are instantiated correctly

        @test_category object_mapper
        """
        list_list = columns.List(columns.List(columns.Integer), required=False)
        map_list = columns.Map(columns.Text, columns.List(columns.Text), required=False)
        set_tuple = columns.Set(columns.Tuple(columns.Integer, columns.Integer), required=False)

        self.assertIsInstance(list_list, columns.List)
        self.assertIsInstance(list_list.types[0], columns.List)
        self.assertIsInstance(map_list.types[0], columns.Text)
        self.assertIsInstance(map_list.types[1], columns.List)
        self.assertIsInstance(set_tuple.types[0], columns.Tuple)
Exemplo n.º 3
0
class TestIndexSetModel(Model):
    partition = columns.UUID(primary_key=True)
    int_set = columns.Set(columns.Integer, index=True)
    int_list = columns.List(columns.Integer, index=True)
    text_map = columns.Map(columns.Text, columns.DateTime, index=True)
    mixed_tuple = columns.Tuple(columns.Text, columns.Integer, columns.Text, index=True)
class TestCamelMapModel(Model):

    partition = columns.UUID(primary_key=True, default=uuid4)
    camelMap = columns.Map(columns.Text, columns.Integer, required=False)
class TestMapModel(Model):
    partition = columns.UUID(primary_key=True, default=uuid4)
    int_map = columns.Map(columns.Integer, columns.UUID, required=False)
    text_map = columns.Map(columns.Text, columns.DateTime, required=False)