def test_access_to_invalid_attribute_on_contact(): table = Table() contact = Contact(from_table=table) err = False try: contact.name = "John Doe" except ValueError, e: err = True
def test_create_table(): table = Table() table.add_column(Column("email", COLUMN_TYPE_TEXT, None, is_key=True)) table.add_column(Column("firstname", COLUMN_TYPE_TEXT)) table.add_column(Column("lastname", COLUMN_TYPE_TEXT)) table.add_column(Column("is_blue", COLUMN_TYPE_YESNO)) contact = Contact(from_table=table) contact.email = "*****@*****.**" contact.firstname = "John" contact.lastname = "Doe" contact.is_blue = True key_column = next(iter(table.key_columns), None) assert key_column == "email" assert len(table.column_names) == 4