print('EXCEPTIONS TESTER') from Handler import Handler from Exceptions import * handler = Handler() handler.create_object('aiuda', { 'que': 'str', 'dios': 'str', 'me': 'str', 'acompane': 'str' }) handler.create_library('test') handler.create_collection('test', 'col', 'aiuda') e = handler.openLibrary('nose') 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')
from Handler import Handler handler = Handler() handler.create_library('PersonalidadesDeHelp') handler.create_object('help', {'name': 'str', 'nivel': 'int'}) handler.openLibrary('PersonalidadesDeHelp') handler.create_collection('PersonalidadesDeHelp', 'help1', 'help') handler.create_collection('PersonalidadesDeHelp', 'help2', 'help') handler.add_object('PersonalidadesDeHelp', 'help1', ['el que no sabe lo que dice', 6]) handler.add_object('PersonalidadesDeHelp', 'help1', ['el que habla mucho', 2]) handler.add_object('PersonalidadesDeHelp', 'help2', ['el que no te deja estudiar', 8]) handler.add_object('PersonalidadesDeHelp', 'help2', ['la housemate', 10]) #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')