1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import os
import warnings
import urllib
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, ROOT)
import pygooglechart as gc
class TestBase(unittest.TestCase):
def setUp(self):
# All tests require warnings to be raised
self.raise_warnings(True)
self.temp_image = 'temp.png'
def tearDown(self):
if os.path.exists(self.temp_image):
os.unlink(self.temp_image)
def raise_warnings(self, rw):
gc._reset_warnings()
if rw:
warnings.simplefilter('error')
else:
# Don't print out warnings if we're expecting them--so we can have
# nicer looking tests! :)
warnings.simplefilter('ignore')
def assertChartURL(self, url, query):
self.assertTrue(url.endswith(query))
|