Skip to content

Commit

Permalink
complete basic write test
Browse files Browse the repository at this point in the history
  • Loading branch information
robin900 committed Apr 2, 2017
1 parent eaa6e26 commit f41a0a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 12 additions & 11 deletions tests/gspread_dataframe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from gspread_dataframe import *
import numpy as np
import pandas as pd
from difflib import SequenceMatcher

import unittest
from unittest.mock import Mock, MagicMock
Expand All @@ -13,15 +14,15 @@
# Expected results

COLUMN_NAMES = [
'Thingy',
'Syntax',
'Numeric Column',
'Formula Column',
'Date Column',
'Values are...',
'Selection',
'Label(s) referencible in chart title',
'Dialect-specific implementations',
'Thingy',
'Syntax',
'Numeric Column',
'Formula Column',
'Date Column',
'Values are...',
'Selection',
'Label(s) referencible in chart title',
'Dialect-specific implementations',
'Notes'
]

Expand Down Expand Up @@ -137,5 +138,5 @@ def test_write_basic(self):
df = get_as_dataframe(self.sheet)
set_with_dataframe(self.sheet, df, resize=True)
self.sheet.resize.assert_called_once_with(10, 10)
from difflib import SequenceMatcher
#self.sheet.client.post_cells.assert_called_once_with(self.sheet, POST_CELLS_EXPECTED.encode('utf8'))
self.sheet.client.post_cells.assert_called_once()
self.sheet.client.post_cells.assert_called_once_with(self.sheet, POST_CELLS_EXPECTED)
3 changes: 2 additions & 1 deletion tests/mock_worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ def contents_of_file(filename, et_parse=True):

CELL_FEED = contents_of_file('cell_feed.xml')
WORKSHEET_FEED = contents_of_file('worksheet_feed.xml')
POST_CELLS_EXPECTED = contents_of_file('post_cells_expected.xml', False)
POST_CELLS_EXPECTED = contents_of_file('post_cells_expected.xml', False).encode('utf8')

class MockWorksheet(object):

def _fetch_cells(self):
return [Cell(self, elem) for elem in CELL_FEED.findall(_ns('entry'))]

Expand Down

0 comments on commit f41a0a1

Please sign in to comment.