| 1 | ========================== |
|---|
| 2 | A GSpreadsheet content type doctest |
|---|
| 3 | ========================== |
|---|
| 4 | |
|---|
| 5 | Import the class. |
|---|
| 6 | |
|---|
| 7 | >>> from quintagroup.gdocs.spreadsheet.content.gspreadsheet import GSpreadsheet |
|---|
| 8 | |
|---|
| 9 | Create object |
|---|
| 10 | |
|---|
| 11 | >>> my_context = GSpreadsheet('id') |
|---|
| 12 | |
|---|
| 13 | Testing set attributes of class GSpreadsheet |
|---|
| 14 | |
|---|
| 15 | >>> my_context.title = u"Some title" |
|---|
| 16 | >>> my_context.description = u"Some description" |
|---|
| 17 | >>> my_context.spreadsheet_id = u"Some spreadsheet id" |
|---|
| 18 | >>> my_context.worksheet_id = u"Some worksheet id" |
|---|
| 19 | >>> my_context.order_columns = ({'column_key': 'col1', 'column_title': 'Title 1'},) |
|---|
| 20 | |
|---|
| 21 | >>> my_context.title |
|---|
| 22 | 'Some title' |
|---|
| 23 | >>> my_context.description |
|---|
| 24 | 'Some description' |
|---|
| 25 | >>> my_context.spreadsheet_id |
|---|
| 26 | 'Some spreadsheet id' |
|---|
| 27 | >>> my_context.worksheet_id |
|---|
| 28 | 'Some worksheet id' |
|---|
| 29 | >>> len(my_context.order_columns) |
|---|
| 30 | 1 |
|---|
| 31 | >>> my_context.order_columns[0]['column_key'] |
|---|
| 32 | 'col1' |
|---|
| 33 | >>> my_context.order_columns[0]['column_title'] |
|---|
| 34 | 'Title 1' |
|---|
| 35 | |
|---|
| 36 | Testing all_keys_columns property method of class GSpreadsheet |
|---|
| 37 | |
|---|
| 38 | >>> my_context.all_keys_columns |
|---|
| 39 | ['col1', 'col2', 'col3', 'col4', 'col5'] |
|---|
| 40 | |
|---|
| 41 | Testing getKeyColumnVocabulary method of class GSpreadsheet |
|---|
| 42 | |
|---|
| 43 | >>> kcv = my_context.getKeyColumnVocabulary() |
|---|
| 44 | >>> len(kcv) |
|---|
| 45 | 5 |
|---|
| 46 | >>> kcv[0] |
|---|
| 47 | 'col1' |
|---|
| 48 | >>> kcv[4] |
|---|
| 49 | 'col5' |
|---|
| 50 | |
|---|