Ticket #22738: 22738-1.diff

File 22738-1.diff, 1.2 KB (added by Claude Paroz, 10 years ago)

Take Oracle bug into account

  • tests/schema/tests.py

    diff --git a/tests/schema/tests.py b/tests/schema/tests.py
    index c51ef97..7d448ca 100644
    a b class SchemaTests(TransactionTestCase):  
    312312            )
    313313        # Ensure the field is right afterwards
    314314        columns = self.column_classes(Author)
    315         # BooleanField are stored as TINYINT(1) on MySQL.
    316315        field_type, field_info = columns['awesome']
    317         if connection.vendor == 'mysql':
    318             self.assertEqual(field_type, 'IntegerField')
    319             self.assertEqual(field_info.precision, 1)
    320         elif connection.vendor == 'oracle' and connection.version_has_default_introspection_bug:
    321             self.assertEqual(field_type, 'IntegerField')
    322             self.assertEqual(field_info.precision, 0)
     316        if (not connection.features.can_introspect_boolean_field or
     317                connection.vendor == 'oracle' and connection.version_has_default_introspection_bug):
     318            # e.g. BooleanField are stored as TINYINT(1) on MySQL.
     319            self.assertIn(field_type, ('SmallIntegerField', 'IntegerField'))
    323320        else:
    324321            self.assertEqual(field_type, 'BooleanField')
    325322
Back to Top