def test_wikilib_eroot(): lib = wikilib.Library() smith = wikilib.Writer() lib.writers.append(smith) assert smith.eContainer() is lib assert smith.eRoot() is lib assert wikilib.Library.eClass.eRoot() is wikilib.eClass
def test_wikilib_econtents(): smith = wikilib.Writer() book = wikilib.Book() lib = wikilib.Library() lib.writers.append(smith) lib.books.append(book) assert smith in lib.eContents assert book in lib.eContents
def test_link_writer2manybooks(): book1 = wikilib.Book() book2 = wikilib.Book() smith = wikilib.Writer() smith.books.extend([book1, book2]) assert smith.books and book1 in smith.books and book2 in smith.books assert book1.authors and smith in book1.authors assert book2.authors and smith in book2.authors
def test_instance_eisset(): smith = wikilib.Writer() assert smith._isset == set() smith.name = 'SmithIsMyName' assert wikilib.Writer.name in smith._isset assert smith.eIsSet(wikilib.Writer.name) assert smith.eIsSet('name') smith.name = None assert wikilib.Writer.name in smith._isset assert smith.eIsSet(wikilib.Writer.name) assert smith.eIsSet('name')
def test_instance_urifragment(): lib = wikilib.Library() assert lib.eURIFragment() == '/' smith = wikilib.Writer() lib.writers.append(smith) assert smith.eURIFragment() == '//@writers.0'
def test_link_writer2book(): book = wikilib.Book() smith = wikilib.Writer() smith.books.append(book) assert smith.books and smith.books[0] is book assert book.authors and book.authors[0] is smith
def test_create_writer(): smith = wikilib.Writer() assert smith and isinstance(smith, Ecore.EObject) assert smith.name is None assert smith.books == []