MCPcopy Index your code
hub / github.com/PyMySQL/mysqlclient / test_DECIMAL

Method test_DECIMAL

tests/capabilities.py:214–232  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

212 self.check_data_integrity(("col1 INT",), generator)
213
214 def test_DECIMAL(self):
215 # DECIMAL
216 from decimal import Decimal
217
218 def generator(row, col):
219 return Decimal("%d.%02d" % (row, col))
220
221 self.check_data_integrity(("col1 DECIMAL(5,2)",), generator)
222
223 val = Decimal("1.11111111111111119E-7")
224 self.cursor.execute("SELECT %s", (val,))
225 result = self.cursor.fetchone()[0]
226 self.assertEqual(result, val)
227 self.assertIsInstance(result, Decimal)
228
229 self.cursor.execute("SELECT %s + %s", (Decimal("0.1"), Decimal("0.2")))
230 result = self.cursor.fetchone()[0]
231 self.assertEqual(result, Decimal("0.3"))
232 self.assertIsInstance(result, Decimal)
233
234 def test_DATE(self):
235 ticks = time()

Callers

nothing calls this directly

Calls 3

check_data_integrityMethod · 0.95
executeMethod · 0.80
fetchoneMethod · 0.45

Tested by

no test coverage detected