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