コード例 #1
0
    def test_contains_title_field(self):

        model = loadString(self.address_model)

        set_columns(model.schema, [['country', 'lastname']])

        columns = unrestricted_get_schema_columns(model.schema)
        self.assertEqual(columns[0].contains_title_field, False)

        set_title_fields(model.schema, ['lastname'])
        columns = unrestricted_get_schema_columns(model.schema)
        self.assertEqual(columns[0].contains_title_field, True)

        set_title_fields(model.schema, ['firstname'])
        columns = unrestricted_get_schema_columns(model.schema)
        self.assertEqual(columns[0].contains_title_field, False)

        set_columns(model.schema, [['firstname']])
        columns = unrestricted_get_schema_columns(model.schema)
        self.assertEqual(columns[0].contains_title_field, True)
コード例 #2
0
    def test_one_column(self):

        model = loadString(self.address_model)

        set_columns(model.schema, [['lastname']])
        columns = unrestricted_get_schema_columns(model.schema)

        self.assertEqual(len(columns), 1)
        self.assertEqual(columns[0].schema, model.schema)
        self.assertEqual(columns[0].fields, ['lastname'])
        self.assertEqual(columns[0].titles, [u'Nachname'])
        self.assertEqual(columns[0].contains_title_field, False)
コード例 #3
0
    def test_merged_columns(self):

        model = loadString(self.address_model)

        set_columns(model.schema, [['country', 'lastname']])
        columns = unrestricted_get_schema_columns(model.schema)

        self.assertEqual(len(columns), 1)

        # ordered by field order
        self.assertEqual(columns[0].fields, ['lastname', 'country'])
        self.assertEqual(columns[0].titles, [u'Nachname', u'Land'])
        self.assertEqual(columns[0].contains_title_field, False)
コード例 #4
0
    def test_no_columns(self):

        model = loadString(self.address_model)
        columns = unrestricted_get_schema_columns(model.schema)

        self.assertEqual(columns, [])