Exemple #1
0
 def test_real(self):
     Real(default=0.0)
     Real(default=None, null=True)
     with self.assertRaises(ValueError):
         Real(default="hello world")
     with self.assertRaises(ValueError):
         Real(default=None, null=False)
 def test_column_type_conversion_float_decimal(self):
     self._test_migrations(
         table_snapshots=[[self.table(column)] for column in [
             Real(default=1.0),
             DoublePrecision(default=1.0),
             Real(default=1.0),
             Numeric(),
             Real(default=1.0),
         ]])
Exemple #3
0
class MegaTable(Table):
    """
    A table containing all of the column types, and different column kwargs.
    """

    bigint_col = BigInt()
    boolean_col = Boolean()
    bytea_col = Bytea()
    date_col = Date()
    foreignkey_col = ForeignKey(SmallTable)
    integer_col = Integer()
    interval_col = Interval()
    json_col = JSON()
    jsonb_col = JSONB()
    numeric_col = Numeric(digits=(5, 2))
    real_col = Real()
    double_precision_col = DoublePrecision()
    smallint_col = SmallInt()
    text_col = Text()
    timestamp_col = Timestamp()
    timestamptz_col = Timestamptz()
    uuid_col = UUID()
    varchar_col = Varchar()

    unique_col = Varchar(unique=True)
    null_col = Varchar(null=True)
    not_null_col = Varchar(null=False)
 def test_real_column(self):
     self._test_migrations(
         table_snapshots=[[self.table(column)] for column in [
             Real(),
             Real(default=1.1),
             Real(null=True),
             Real(null=False),
             Real(index=True),
             Real(index=False),
         ]],
         test_function=lambda x: all([
             x.data_type == "real",
             x.is_nullable == "NO",
             x.column_default == "0.0",
         ]),
     )
Exemple #5
0
class MegaTable(Table):
    """
    A table containing all of the column types, and different column kwargs.
    """

    array_col = Array(Varchar())
    bigint_col = BigInt()
    boolean_col = Boolean()
    bytea_col = Bytea()
    date_col = Date()
    double_precision_col = DoublePrecision()
    integer_col = Integer()
    interval_col = Interval()
    json_col = JSON()
    jsonb_col = JSONB()
    numeric_col = Numeric(digits=(5, 2))
    real_col = Real()
    smallint_col = SmallInt()
    text_col = Text()
    timestamp_col = Timestamp()
    timestamptz_col = Timestamptz()
    uuid_col = UUID()
    varchar_col = Varchar()
Exemple #6
0
class MyTable(Table):
    column_a = Real()