# Path: delphin/codecs/edsjson.py
# CODEC_INFO = {
#     'representation': 'eds',
# }
# HEADER = '['
# JOINER = ','
# FOOTER = ']'
# def load(source):
# def loads(s):
# def dump(es, destination, properties=True, lnk=True,
#          indent=False, encoding='utf-8'):
# def dumps(es, properties=True, lnk=True, indent=False):
# def decode(s):
# def encode(eds, properties=True, lnk=True, indent=False):
# def to_dict(eds, properties=True, lnk=True):
# def from_dict(d):
# 
# Path: delphin/codecs/dmrsjson.py
# CODEC_INFO = {
#     'representation': 'dmrs',
# }
# HEADER = '['
# JOINER = ','
# FOOTER = ']'
# def load(source):
# def loads(s):
# def dump(ds, destination, properties=True, lnk=True,
#          indent=False, encoding='utf-8'):
# def dumps(ds, properties=True, lnk=True, indent=False):
# def decode(s):
# def encode(d, properties=True, lnk=True, indent=False):
# def to_dict(d, properties=True, lnk=True):
# def from_dict(d):
#     def _lnk(x):
# 
# Path: delphin/derivation.py
# class DerivationSyntaxError(PyDelphinSyntaxError):
# class _UDFNodeBase(object):
# class UDFToken(namedtuple('UDFToken', 'id tfs')):
# class UDFTerminal(_UDFNodeBase, namedtuple('UDFTerminal', 'form tokens')):
# class UDFNode(_UDFNodeBase,
#               namedtuple('UDFNode', 'id entity score start end daughters')):
# class Derivation(UDFNode):
# def from_string(s):
# def from_dict(d):
#     def __str__(self):
#     def __ne__(self, other):
#     def parent(self):
#     def to_udf(self, indent=1):
#     def to_udx(self, indent=1):
#     def to_dict(self, fields=_all_fields, labels=None):
#     def __new__(cls, id, tfs):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __new__(cls, form, tokens=None, parent=None):
#     def __repr__(self):
#     def __eq__(self, other):
#     def is_root(self):
#     def __new__(cls, id, entity,
#                 score=None, start=None, end=None, daughters=None,
#                 head=None, type=None, parent=None):
#     def __repr__(self):
#     def __eq__(self, other):
#     def is_root(self):
#     def is_head(self):
#     def preterminals(self):
#     def terminals(self):
#     def internals(self):
#     def __init__(self, id, entity,
#                  score=None, start=None, end=None, daughters=None,
#                  head=None, type=None, parent=None):
# def _from_string(s):
# def _unquote(s):
# def _udf_tokens(tokenstring):
# def _from_dict(d, parent=None):
# def _to_udf(obj, indent, level, udx=False):
# def _to_dict(obj, fields, labels):
# def _map_labels(drv, labels):
# def _to_dict_recursive(obj, fields, labels):
# 
# Path: delphin/tokens.py
# class _YYToken(NamedTuple):
# class YYToken(_YYToken):
# class YYTokenLattice(object):
#     def __new__(cls, id, start, end,
#                 lnk=None, paths=(1,), form=None, surface=None,
#                 ipos=0, lrules=("null",), pos=()):
#     def __str__(self):
#     def from_dict(cls, d):
#     def to_dict(self):
#     def __init__(self, tokens):
#     def from_string(cls, s):
#         def _qstrip(s):
#     def from_list(cls, toks):
#     def to_list(self):
#     def __str__(self):
#     def __eq__(self, other):


from delphin.interface import Response, Result
from delphin.codecs import (
    edsjson,
    simplemrs,
    dmrsjson)
from delphin import derivation
from delphin import tokens
    assert len(r) == 1
    assert r['derivation'] == deriv_d
    assert r.derivation() == deriv


def test_Response():
    r = Response()
    assert len(r) == 0
    assert r.results() == []
    assert r.tokens() is None

    r = Response(key="val")
    assert len(r) == 1
    assert r['key'] == 'val'

    r = Response(results=[{}])
    assert len(r) == 1
    assert r['results'] == [{}]
    assert isinstance(r.results()[0], Result)
    assert isinstance(r.result(0), Result)

    toks_s = '(1, 0, 1, <0:4>, 1, "Dogs", 0, "null")'
    toks_d = [
        {'id': 1, 'start': 0, 'end': 1, 'from': 0, 'to': 4, "form": "Dogs"}
    ]
    toks = tokens.YYTokenLattice.from_list(toks_d)

    r = Response(tokens={'initial': toks_s})
    assert r['tokens']['initial'] == toks_s
    assert r.tokens('initial') == toks

# Path: delphin/codecs/edsjson.py
# CODEC_INFO = {
#     'representation': 'eds',
# }
# HEADER = '['
# JOINER = ','
# FOOTER = ']'
# def load(source):
# def loads(s):
# def dump(es, destination, properties=True, lnk=True,
#          indent=False, encoding='utf-8'):
# def dumps(es, properties=True, lnk=True, indent=False):
# def decode(s):
# def encode(eds, properties=True, lnk=True, indent=False):
# def to_dict(eds, properties=True, lnk=True):
# def from_dict(d):
# 
# Path: delphin/codecs/dmrsjson.py
# CODEC_INFO = {
#     'representation': 'dmrs',
# }
# HEADER = '['
# JOINER = ','
# FOOTER = ']'
# def load(source):
# def loads(s):
# def dump(ds, destination, properties=True, lnk=True,
#          indent=False, encoding='utf-8'):
# def dumps(ds, properties=True, lnk=True, indent=False):
# def decode(s):
# def encode(d, properties=True, lnk=True, indent=False):
# def to_dict(d, properties=True, lnk=True):
# def from_dict(d):
#     def _lnk(x):
# 
# Path: delphin/derivation.py
# class DerivationSyntaxError(PyDelphinSyntaxError):
# class _UDFNodeBase(object):
# class UDFToken(namedtuple('UDFToken', 'id tfs')):
# class UDFTerminal(_UDFNodeBase, namedtuple('UDFTerminal', 'form tokens')):
# class UDFNode(_UDFNodeBase,
#               namedtuple('UDFNode', 'id entity score start end daughters')):
# class Derivation(UDFNode):
# def from_string(s):
# def from_dict(d):
#     def __str__(self):
#     def __ne__(self, other):
#     def parent(self):
#     def to_udf(self, indent=1):
#     def to_udx(self, indent=1):
#     def to_dict(self, fields=_all_fields, labels=None):
#     def __new__(cls, id, tfs):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __new__(cls, form, tokens=None, parent=None):
#     def __repr__(self):
#     def __eq__(self, other):
#     def is_root(self):
#     def __new__(cls, id, entity,
#                 score=None, start=None, end=None, daughters=None,
#                 head=None, type=None, parent=None):
#     def __repr__(self):
#     def __eq__(self, other):
#     def is_root(self):
#     def is_head(self):
#     def preterminals(self):
#     def terminals(self):
#     def internals(self):
#     def __init__(self, id, entity,
#                  score=None, start=None, end=None, daughters=None,
#                  head=None, type=None, parent=None):
# def _from_string(s):
# def _unquote(s):
# def _udf_tokens(tokenstring):
# def _from_dict(d, parent=None):
# def _to_udf(obj, indent, level, udx=False):
# def _to_dict(obj, fields, labels):
# def _map_labels(drv, labels):
# def _to_dict_recursive(obj, fields, labels):
# 
# Path: delphin/tokens.py
# class _YYToken(NamedTuple):
# class YYToken(_YYToken):
# class YYTokenLattice(object):
#     def __new__(cls, id, start, end,
#                 lnk=None, paths=(1,), form=None, surface=None,
#                 ipos=0, lrules=("null",), pos=()):
#     def __str__(self):
#     def from_dict(cls, d):
#     def to_dict(self):
#     def __init__(self, tokens):
#     def from_string(cls, s):
#         def _qstrip(s):
#     def from_list(cls, toks):
#     def to_list(self):
#     def __str__(self):
#     def __eq__(self, other):


# Path: tests/interface_test.py
from delphin.interface import Response, Result
from delphin.codecs import (
    edsjson,
    simplemrs,
    dmrsjson)
from delphin import derivation
from delphin import tokens

    assert len(r) == 1
    assert r['derivation'] == deriv_d
    assert r.derivation() == deriv


def test_Response():
    r = Response()
    assert len(r) == 0
    assert r.results() == []
    assert r.tokens() is None

    r = Response(key="val")
    assert len(r) == 1
    assert r['key'] == 'val'

    r = Response(results=[{}])
    assert len(r) == 1
    assert r['results'] == [{}]
    assert isinstance(r.results()[0], Result)
    assert isinstance(r.result(0), Result)

    toks_s = '(1, 0, 1, <0:4>, 1, "Dogs", 0, "null")'
    toks_d = [
        {'id': 1, 'start': 0, 'end': 1, 'from': 0, 'to': 4, "form": "Dogs"}
    ]
    toks = tokens.YYTokenLattice.from_list(toks_d)

    r = Response(tokens={'initial': toks_s})
    assert r['tokens']['initial'] == toks_s
    assert r.tokens('initial') == toks

    assert r.tokens('internal') is None