Ejemplo n.º 1
0
    def test_can_add_function_with_arg_before_attribute(self):
        g = Gremlin()
        
        g.function('val').a
        
        string      = str(g)
        bind, value = g.bound_params.copy().popitem()
        expected    = 'g.function(%s).a' % bind

        self.assertTrue(string == expected)
        self.assertTrue(len(g.bound_params) == 1)
Ejemplo n.º 2
0
    def test_can_add_function_with_arg_before_attribute(self):
        g = Gremlin()

        g.function('val').a

        string = str(g)
        bind, value = g.bound_params.copy().popitem()
        expected = 'g.function(%s).a' % bind

        self.assertTrue(string == expected)
        self.assertTrue(len(g.bound_params) == 1)
Ejemplo n.º 3
0
    def test_can_add_functon_manually_bind_two_args(self):
        g      = Gremlin()
        bound  = g.bind_param('arg')
        bound2 = g.bind_param('arg2')
        
        g.function(bound[0], bound2[0])
        
        string   = str(g)
        expected = 'g.function(%s, %s)' % (bound[0], bound2[0])

        self.assertTrue(string == expected)
        self.assertTrue(len(g.bound_params) == 2)
Ejemplo n.º 4
0
    def test_can_add_functon_manually_bind_two_args(self):
        g = Gremlin()
        bound = g.bind_param('arg')
        bound2 = g.bind_param('arg2')

        g.function(bound[0], bound2[0])

        string = str(g)
        expected = 'g.function(%s, %s)' % (bound[0], bound2[0])

        self.assertTrue(string == expected)
        self.assertTrue(len(g.bound_params) == 2)
Ejemplo n.º 5
0
    def test_can_add_functon_manually_bind_one_arg(self):
        g     = Gremlin()
        bound = g.bind_param('arg')
        
        g.function(bound[0])
        
        string      = str(g)
        bind, value = g.bound_params.copy().popitem()
        expected    = 'g.function(%s)' % bind

        self.assertTrue(string == expected)
        self.assertTrue(bind == bound[0])
        self.assertTrue(value == bound[1])
        self.assertTrue(len(g.bound_params) == 1)
Ejemplo n.º 6
0
    def test_can_add_functon_manually_bind_one_arg(self):
        g = Gremlin()
        bound = g.bind_param('arg')

        g.function(bound[0])

        string = str(g)
        bind, value = g.bound_params.copy().popitem()
        expected = 'g.function(%s)' % bind

        self.assertTrue(string == expected)
        self.assertTrue(bind == bound[0])
        self.assertTrue(value == bound[1])
        self.assertTrue(len(g.bound_params) == 1)