Last change
on this file since 2757 was
2757,
checked in by liebster, 14 years ago
|
Add doctests of context and adapter
|
File size:
829 bytes
|
Rev | Line | |
---|
[2757] | 1 | ========================== |
---|
| 2 | A GSpreadsheetDataProvider adapter 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 | Get adapter |
---|
| 14 | |
---|
| 15 | >>> from quintagroup.gdocs.spreadsheet.interfaces import IGSpreadsheetDataProvider |
---|
| 16 | >>> adapter = IGSpreadsheetDataProvider(my_context) |
---|
| 17 | |
---|
| 18 | Testing methods of adapter |
---|
| 19 | |
---|
| 20 | >>> wci = adapter.getWorksheetColumnsInfo() |
---|
| 21 | >>> wci |
---|
| 22 | ['col1', 'col2', 'col3', 'col4', 'col5'] |
---|
| 23 | >>> feed = adapter.getListFeed() |
---|
| 24 | >>> len(feed.entry) |
---|
| 25 | 5 |
---|
| 26 | >>> keys = feed.entry[0].custom.keys() |
---|
| 27 | >>> keys.sort() |
---|
| 28 | >>> keys |
---|
| 29 | ['col1', 'col2', 'col3', 'col4', 'col5'] |
---|
| 30 | >>> [feed.entry[0].custom[key].text for key in keys] |
---|
| 31 | ['11', '12', '13', '14', '15'] |
---|
| 32 | |
---|
Note: See
TracBrowser
for help on using the repository browser.