def test_numeric_nan_float(self, connection): m = self.metadata t1 = Table( "t1", m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=False)), ) t1.create() t1.insert().execute( [ dict(intcol=1, numericcol=float("nan")), dict(intcol=2, numericcol=float("-nan")), ] ) eq_( [ tuple(str(col) for col in row) for row in select([t1.c.numericcol]) .order_by(t1.c.intcol) .execute() ], [("nan",), ("nan",)], ) eq_( [ tuple(str(col) for col in row) for row in exec_sql( connection, "select numericcol from t1 order by intcol" ) ], [("nan",), ("nan",)], )
def _dont_test_numeric_nan_decimal(self, connection): m = self.metadata t1 = Table( "t1", m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=True)), ) t1.create() t1.insert().execute( [ dict(intcol=1, numericcol=decimal.Decimal("NaN")), dict(intcol=2, numericcol=decimal.Decimal("-NaN")), ] ) eq_( select([t1.c.numericcol]) .order_by(t1.c.intcol) .execute() .fetchall(), [(decimal.Decimal("NaN"),), (decimal.Decimal("NaN"),)], ) eq_( exec_sql( connection, "select numericcol from t1 order by intcol" ).fetchall(), [(decimal.Decimal("NaN"),), (decimal.Decimal("NaN"),)], )
def test_numeric_infinity_float(self, connection): m = self.metadata t1 = Table( "t1", m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=False)), ) t1.create() t1.insert().execute( [ dict(intcol=1, numericcol=float("inf")), dict(intcol=2, numericcol=float("-inf")), ] ) eq_( select([t1.c.numericcol]) .order_by(t1.c.intcol) .execute() .fetchall(), [(float("inf"),), (float("-inf"),)], ) eq_( exec_sql( connection, "select numericcol from t1 order by intcol" ).fetchall(), [(float("inf"),), (float("-inf"),)], )
def test_numeric_infinity_decimal(self, metadata, connection): m = metadata t1 = Table( "t1", m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=True)), ) t1.create(connection) connection.execute( t1.insert(), [ dict(intcol=1, numericcol=decimal.Decimal("Infinity")), dict(intcol=2, numericcol=decimal.Decimal("-Infinity")), ], ) eq_( connection.execute(select(t1.c.numericcol).order_by( t1.c.intcol)).fetchall(), [(decimal.Decimal("Infinity"), ), (decimal.Decimal("-Infinity"), )], ) eq_( exec_sql(connection, "select numericcol from t1 order by intcol").fetchall(), [(decimal.Decimal("Infinity"), ), (decimal.Decimal("-Infinity"), )], )
def test_numeric_infinity_decimal(self): m = self.metadata t1 = Table( "t1", m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=True)), ) t1.create() t1.insert().execute([ dict(intcol=1, numericcol=decimal.Decimal("Infinity")), dict(intcol=2, numericcol=decimal.Decimal("-Infinity")), ]) eq_( select([t1.c.numericcol ]).order_by(t1.c.intcol).execute().fetchall(), [(decimal.Decimal("Infinity"), ), (decimal.Decimal("-Infinity"), )], ) eq_( testing.db.execute( "select numericcol from t1 order by intcol").fetchall(), [(decimal.Decimal("Infinity"), ), (decimal.Decimal("-Infinity"), )], )
def test_numeric_infinity_float(self): m = self.metadata t1 = Table('t1', m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=False))) t1.create() t1.insert().execute([ dict( intcol=1, numericcol=float("inf") ), dict( intcol=2, numericcol=float("-inf") ), ]) eq_( select([t1.c.numericcol]). order_by(t1.c.intcol).execute().fetchall(), [(float('inf'), ), (float('-inf'), )] ) eq_( testing.db.execute( "select numericcol from t1 order by intcol").fetchall(), [(float('inf'), ), (float('-inf'), )] )
def test_numeric_infinity_float(self): m = self.metadata t1 = Table('t1', m, Column("intcol", Integer), Column("numericcol", oracle.BINARY_DOUBLE(asdecimal=False))) t1.create() t1.insert().execute( intcol=1, numericcol=float("inf"), ) eq_(select([t1.c.numericcol]).scalar(), float("inf")) eq_(testing.db.scalar("select numericcol from t1"), float("inf"))