예제 #1
0
    def test_attr_simple_action(self):
        """ActionProxy object reads the right input attribute."""
        node = Node.Node(None, None)
        node.backend = None
        proxy = Proxy.ActionProxy(node)
        func = proxy.attr

        self.assertEqual(proxy._cur_attr, "attr")
        self.assertTrue(callable(func))
예제 #2
0
 def test_type_return_action(self):
     """
     ActionProxy object is of type `DistRDF.ActionProxy` and
     wraps a node object.
     """
     node = Node.Node(None, None)
     node.backend = None
     proxy = Proxy.ActionProxy(node)
     self.assertIsInstance(proxy, Proxy.ActionProxy)
     self.assertIsInstance(proxy.proxied_node, Node.Node)
예제 #3
0
    def test_get_value_with_existing_value(self):
        """
        Test case to check the working of 'GetValue'
        method in Proxy when the current action node
        already houses a value.
        """
        node = Node.Node(None, None)
        node.backend = None
        proxy = Proxy.ActionProxy(node)
        node.value = 5

        self.assertEqual(proxy.GetValue(), 5)
예제 #4
0
    def test_return_value(self):
        """
        Proxy object computes and returns the right output based on the
        function call.
        """
        t = AttrReadTest.Temp()
        node = Node.Node(None, None)
        node.backend = None
        node.value = t
        proxy = Proxy.ActionProxy(node)

        self.assertEqual(proxy.val(21), 144)