def test_parameter_processing_with_nulls_as_composite_fields(self):
     account = self.Account(
         categories=[(None,
                      'bad'), (intervals.DecimalInterval([18, 20]), None)])
     self.session.add(account)
     self.session.commit()
     assert account.categories[0].scale is None
     assert account.categories[0].name == 'bad'
     assert (account.categories[1].scale == intervals.DecimalInterval(
         [18, 20]))
     assert account.categories[1].name is None
Beispiel #2
0
    def test_parameter_processing_with_tuple(self, session, Account):
        account = Account(
            categories=[(intervals.DecimalInterval([15, 18]),
                         'bad'), (intervals.DecimalInterval([18, 20]),
                                  'good')])

        session.add(account)
        session.commit()

        account = session.query(Account).first()
        assert (account.categories[0].scale == intervals.DecimalInterval(
            [15, 18]))
        assert account.categories[0].name == 'bad'
        assert (account.categories[1].scale == intervals.DecimalInterval(
            [18, 20]))
        assert account.categories[1].name == 'good'