/+junk/pygooglechart-py3k

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/pygooglechart-py3k

« back to all changes in this revision

Viewing changes to test/test_base.py

  • Committer: gak
  • Date: 2009-03-15 08:30:28 UTC
  • Revision ID: git-v1:33085bb9ee79265f2d97b0024c1b3bf33db09836
 - Version bump to 0.3.0
 - Fixed GPL date
 - Fixed line 80 overruns

Show diffs side-by-side

added added

removed removed

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