Ejemplo n.º 1
0
 def _map_nodes(self, node, references):
     fields = [
         self._transform_field(getattr(node, field.name), references)
         for field in dodge.fields(node)
     ]
     
     new_node = type(node)(*fields)
     # TODO: test location preservation
     location = getattr(node, "location", None)
     if location is not None:
         new_node.location = location
     
     return new_node
Ejemplo n.º 2
0
def fields_of_instance_can_be_retrieved():
    User = dodge.data_class("User", ["username"])
    
    user = User("bob")
    field, = dodge.fields(user)
    assert_equal("username", field.name)
Ejemplo n.º 3
0
def fields_of_instance_can_be_retrieved():
    User = dodge.data_class("User", ["username"])

    user = User("bob")
    field, = dodge.fields(user)
    assert_equal("username", field.name)