def test_object_builder(self): builder = common.ObjectBuilder() for event, value in basic_parse(BytesIO(JSON)): builder.event(event, value) self.assertEqual(builder.value, { 'docs': [ { 'string': 'строка - тест', 'null': None, 'boolean': False, 'integer': 0, 'double': Decimal('0.5'), 'exponent': Decimal('100'), 'long': 10000000000, }, { 'meta': [[1], {}], }, { 'meta': {'key': 'value'}, }, { 'meta': None, }, ], })
def test_scalar_builder(self): builder = common.ObjectBuilder() for event, value in basic_parse(BytesIO(SCALAR_JSON)): builder.event(event, value) self.assertEqual(builder.value, 0)