示例#1
0
 def test_fulltypecode3(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.fulltypecode, "n:16:2")
示例#2
0
 def test_typename(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.typename, "DECIMAL")
示例#3
0
 def test_fulltypecode(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.fulltypecode, "n")
示例#4
0
 def test_fulltypecode2(self):
     v = DlDecimal(Decimal("12.3"), 16)
     self.assertEqual(v.fulltypecode, "n:16")
示例#5
0
 def test_jsonvalue(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.jsonvalue, Decimal("12.3"))
示例#6
0
 def test_jsonvaluenone(self):
     v = DlDecimal(None)
     self.assertIsNone(v.jsonvalue)
示例#7
0
 def test_init5(self):
     with self.assertRaises(ValueError):
         v = DlDecimal(Decimal("12.3"), 5, 0)
示例#8
0
 def test_scale(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.scale, 2)
示例#9
0
 def test_precision2(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.precision, 16)
示例#10
0
 def test_fulltypename3(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.fulltypename, "DECIMAL(16, 2)")
示例#11
0
import unittest
from decimal import Decimal
import datetime
import json

if __name__ == '__main__':
    v = [
        DlDictionary({
            "ID":
            DlInteger(1),
            "NAME":
            DlString("Sherlock Holmes"),
            "ADDRESS":
            DlString("221b, Baker Street, London, NW1 6XE, UK", 200),
            "SALARY":
            DlDecimal(Decimal("12.45"), 16, 2),
            "TAXES":
            DlDecimal(
                Decimal("687192025652473624789243787872498713367.89012")),
            "BIRTHDAY":
            DlDate(datetime.date(2020, 1, 3)),
            "VISIT_TS":
            DlTimestamp(datetime.datetime.now()),
            "IS_MARRIED":
            DlBoolean(False),
            "CHILDREN":
            DlList([]),
            "TEMPERATURE":
            DlDictionary({
                "OUTDOOR": DlDouble(2.3),
                "INDOOR": DlDouble(21.8)