/+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.py

  • Committer: gak
  • Date: 2008-08-23 07:42:00 UTC
  • Revision ID: git-v1:ea1019aa611ec7e9ef59506ce21ecc73c2d0cfa8
 - Minor test fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        # All tests require warnings to be raised
22
22
        self.raise_warnings(True)
23
23
 
 
24
        self.temp_image = 'temp.png'
 
25
 
 
26
    def tearDown(self):
 
27
        if os.exists(self.temp_image):
 
28
            os.unlink(self.temp_image)
 
29
 
24
30
    def raise_warnings(self, rw):
25
31
        gc._reset_warnings()
26
32
 
115
121
            print 'PyQrCodec not installed. Can not test QR code image'
116
122
            return
117
123
 
118
 
        fn = 'temp.png'
119
 
        chart.download(fn)
120
 
        status, string = PyQrcodec.decode(fn)
 
124
        chart.download(self.temp_image)
 
125
        status, string = PyQrcodec.decode(self.temp_image)
121
126
        self.assertTrue(status)
122
127
        self.assertEquals(text, string)
123
128
 
146
151
        self.assertQRImage(chart, text)
147
152
 
148
153
    def test_validate_utf8(self):
149
 
        text = 'こんにちは世界'  # Hello world in Japanese UTF8
 
154
        text = 'こんにちは世界'  # Hello world in Japanese UTF-8
150
155
        chart = gc.QRChart(100, 100)
151
156
        chart.add_data(text)
152
157
        chart.set_ec('H', 0)
162
167
        self.assertChartURL(chart.get_url(), \
163
168
            '?cht=qr&chs=100x100&chl=%82%B1%82%F1%82%C9' \
164
169
            '%82%BF%82%CD%90%A2%8AE&choe=Shift_JIS&chld=H|0')
165
 
        chart.download('temp.png')
 
170
        chart.download(self.temp_image)
166
171
 
167
172
 
168
173
class TestGrammar(TestBase):