Exemple #1
0
 def test_fulltypecode3(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.fulltypecode, "n:16:2")
Exemple #2
0
 def test_typename(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.typename, "DECIMAL")
Exemple #3
0
 def test_fulltypecode(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.fulltypecode, "n")
Exemple #4
0
 def test_fulltypecode2(self):
     v = DlDecimal(Decimal("12.3"), 16)
     self.assertEqual(v.fulltypecode, "n:16")
Exemple #5
0
 def test_jsonvalue(self):
     v = DlDecimal(Decimal("12.3"))
     self.assertEqual(v.jsonvalue, Decimal("12.3"))
Exemple #6
0
 def test_jsonvaluenone(self):
     v = DlDecimal(None)
     self.assertIsNone(v.jsonvalue)
Exemple #7
0
 def test_init5(self):
     with self.assertRaises(ValueError):
         v = DlDecimal(Decimal("12.3"), 5, 0)
Exemple #8
0
 def test_scale(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.scale, 2)
Exemple #9
0
 def test_precision2(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.precision, 16)
Exemple #10
0
 def test_fulltypename3(self):
     v = DlDecimal(Decimal("12.3"), 16, 2)
     self.assertEqual(v.fulltypename, "DECIMAL(16, 2)")
Exemple #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)