# Path: etb/terms.py
# def mk_subst(**bindings):
#     """Named arguments constructor for substitutions. It builds
#     terms from its named arguments.
# 
#     >>> mk_subst(X=mk_numberconst(42), Y=mk_array([mk_numberconst(1),mk_numberconst(2),mk_numberconst(3)]))
#     subst(X = 42, Y = [1, 2, 3])
#     """
#     term_bindings = dict((mk_var(k), v) for k, v in bindings.iteritems())
#     return Subst(term_bindings)
# 
# def mk_numberconst(val):
#     """
#     Make a number constant term out of the given value
#     :parameters:
#     - `val`: a basestring or a NumberConst
#     :returntype:
#     - a hashconsed `NumberConst` instance
#     """
#     if isinstance(val, NumberConst):
#         return val.hashcons()
#     else:
#         t = NumberConst(val)
#         return t.hashcons()
# 
# def mk_literal(pred, args):
#     """
#     Makes a literal from pred (a string) and args (a list or tuple of terms)
#     """
#     l = Literal(pred, args)
#     return l.hashcons()
# 
# def mk_idconst(val):
#     """
#     Make an id constant term out of the given string value.
#     :parameters:
#     - `val`: a basestring or an IdConst
#     :returntype:
#     - a hashconsed `IdConst` instance
#     """
#     if isinstance(val, IdConst):
#         return val.hashcons()
#     else:
#         t = IdConst(val)
#         return t.hashcons()


from etb_manager import ETBNetwork
from etb_tests import etb_test, ETBTest
from etb.terms import mk_subst, mk_numberconst, mk_literal, mk_idconst
import json

    @etb_test
    def multiple_substs_async(self):
        query = self.etb.etb().query('in_range_async(1,4,X)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_answers(query),
                [mk_subst(X = mk_numberconst(1)),
                 mk_subst(X = mk_numberconst(2)),
                 mk_subst(X = mk_numberconst(3)),
                 mk_subst(X = mk_numberconst(4))])

    @etb_test
    def multiple_claims_async(self):
        query = self.etb.etb().query('in_range_async(1,4,X)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_claims(query),
                [mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(1)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(2)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(3)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(4)])])
    
    @etb_test
    def valid_claim_async(self):
        query = self.etb.etb().query('in_range_async(1,4,2)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_claims(query),

# Path: etb/terms.py
# def mk_subst(**bindings):
#     """Named arguments constructor for substitutions. It builds
#     terms from its named arguments.
# 
#     >>> mk_subst(X=mk_numberconst(42), Y=mk_array([mk_numberconst(1),mk_numberconst(2),mk_numberconst(3)]))
#     subst(X = 42, Y = [1, 2, 3])
#     """
#     term_bindings = dict((mk_var(k), v) for k, v in bindings.iteritems())
#     return Subst(term_bindings)
# 
# def mk_numberconst(val):
#     """
#     Make a number constant term out of the given value
#     :parameters:
#     - `val`: a basestring or a NumberConst
#     :returntype:
#     - a hashconsed `NumberConst` instance
#     """
#     if isinstance(val, NumberConst):
#         return val.hashcons()
#     else:
#         t = NumberConst(val)
#         return t.hashcons()
# 
# def mk_literal(pred, args):
#     """
#     Makes a literal from pred (a string) and args (a list or tuple of terms)
#     """
#     l = Literal(pred, args)
#     return l.hashcons()
# 
# def mk_idconst(val):
#     """
#     Make an id constant term out of the given string value.
#     :parameters:
#     - `val`: a basestring or an IdConst
#     :returntype:
#     - a hashconsed `IdConst` instance
#     """
#     if isinstance(val, IdConst):
#         return val.hashcons()
#     else:
#         t = IdConst(val)
#         return t.hashcons()


# Path: tests/in_range.py
from etb_manager import ETBNetwork
from etb_tests import etb_test, ETBTest
from etb.terms import mk_subst, mk_numberconst, mk_literal, mk_idconst
import json


    @etb_test
    def multiple_substs_async(self):
        query = self.etb.etb().query('in_range_async(1,4,X)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_answers(query),
                [mk_subst(X = mk_numberconst(1)),
                 mk_subst(X = mk_numberconst(2)),
                 mk_subst(X = mk_numberconst(3)),
                 mk_subst(X = mk_numberconst(4))])

    @etb_test
    def multiple_claims_async(self):
        query = self.etb.etb().query('in_range_async(1,4,X)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_claims(query),
                [mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(1)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(2)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(3)]),
                 mk_literal(mk_idconst('in_range_async'),
                            [mk_numberconst(1),mk_numberconst(4),mk_numberconst(4)])])
    
    @etb_test
    def valid_claim_async(self):
        query = self.etb.etb().query('in_range_async(1,4,2)')
        self.etb.etb().query_wait(query)
        return (self.etb.query_claims(query),

                [mk_literal(mk_idconst('in_range_async'),