Ejemplo n.º 1
0
from ADT.ObjectType import ObjectType
from ADT.Collection import Collection
from Handler import Handler

# Creating collection with an object that has boolean attributes
ot3 = "Something with bool"
at3 = {"name": "str", "dead": "bool"}
o3 = ObjectType(ot3, at3)
cn3 = "Stuff with list"

handler = Handler()

handler.create_library('Testing something with bool')
handler.create_object(ot3, at3)
handler.create_collection('Testing something with bool', cn3, ot3)
handler.add_object('Testing something with bool', cn3, ["Willy Wonka", False])
handler.add_object('Testing something with bool', cn3, ["Hawking", True])
handler.add_object('Testing something with bool', cn3, ["Pedro", False])
handler.add_object('Testing something with bool', cn3, ["Bienve", None])
handler.add_object('Testing something with bool', cn3, ["Changoma", True])

handler.show_collection('Testing something with bool', cn3)

handler.sort('Testing something with bool', "Stuff with list", 'dead')

handler.show_all_libraries()

handler.remove_library('Testing something with bool')

Ejemplo n.º 2
0
Archivo: test8.py Proyecto: acintr/GODA
print("Library nose does not exist.")
print(e.message())
handler.openLibrary('test')
e = handler.create_object('aiuda', {'que': 'str', 'hostia': 'str'})
print("\nAn object with the name aiuda already exists.")
print(e.message())
e = handler.openLibrary('test')
print("\nLibrary test is already opened.")
print(e.message())
e = handler.close_library('mierda')
print("\nLibrary mierda is not opened.")
print(e.message())
e = handler.create_library('test')
print("\nA library with the name test already exists.")
print(e.message())
e = handler.create_collection('test', 'yizus', 'none')
print("\nObject none does not exist.")
print(e.message())
e = handler.create_collection('test', 'col', 'aiuda')
print("\nA collection with the name col already exists.")
print(e.message())
e = handler.remove_collection_from_library('test', 'help')
print("\nCollection help does not exist.")
print(e.message())
e = handler.remove_object_from_collection('test', 'col', 2)
print("\nAn object with index 2 does not exist.")
print(e.message())
e = handler.sort('test', 'col', 'medalla')
print("\nAttribute medalla does not exist.")
print(e.message())
Ejemplo n.º 3
0
Archivo: test4.py Proyecto: acintr/GODA
#handler.openLibrary('PersonalidadesDeHelp')
print("Testing show library\n")
handler.show_library('PersonalidadesDeHelp')
print("\nTesting show collection\n")
handler.show_collection('PersonalidadesDeHelp', 'help1')
print("\n")
handler.show_collection('PersonalidadesDeHelp', 'help2')

print("\n\nTesting merge\n")
handler.merge('PersonalidadesDeHelp', 'help1', 'PersonalidadesDeHelp', 'help2',
              'help3', 'PersonalidadesDeHelp')
handler.show_collection('PersonalidadesDeHelp', 'help3')

print("\n\nTesting sort by int\n")
handler.sort('PersonalidadesDeHelp', 'help3', 'nivel')
print("\nTesting sort by strings\n")
handler.sort('PersonalidadesDeHelp', 'help3', 'name')

# handler.remove_collection_from_library('PersonalidadesDeHelp', 'help1')
# handler.remove_collection_from_library('PersonalidadesDeHelp', 'help2')

print("\n\nTesting remove 'help1' and 'help2'\n")
handler.show_library('PersonalidadesDeHelp')

print("\n\nTesting delete object at index 1\n")
handler.remove_object_from_collection('PersonalidadesDeHelp', 'help3', 1)
handler.show_collection("PersonalidadesDeHelp", 'help3')

print("\n\nTesting search objects with 'nivel' = 10\n")
handler.search_in_collection('PersonalidadesDeHelp', 'help3', 'nivel', 10)