~ubuntu-branches/ubuntu/raring/dot2tex/raring

« back to all changes in this revision

Viewing changes to tests/test_dot2tex.py

  • Committer: Bazaar Package Importer
  • Author(s): Peter Collingbourne, Sandro Tosi, Marco Rodrigues, Peter Collingbourne
  • Date: 2009-03-15 16:23:06 UTC
  • mfrom: (1.1.9 upstream) (4.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090315162306-cq7opa63u50dbqd4
Tags: 2.8.5-1
[ Sandro Tosi ]
* debian/control
  - switch Vcs-Browser field to viewsvn

[ Marco Rodrigues ]
* debian/control:
  + Add ${misc:Depends} to Depends to remove
    lintian warning.

[ Peter Collingbourne ]
* New upstream release
* debian/control: new Standards-Version
* debian/control: generated files now require pgf >= 2.00
* debian/copyright: changed year to 2009
* debian/control, debian/copyright, debian/dot2tex.1: changed
  maintainer email address (again)
* debian/copyright: refer specifically to GPL-2
* debian/copyright: use the word Copyright to correctly express
  copyright ownership

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
import unittest
 
3
 
 
4
import dot2tex
 
5
 
 
6
testgraph = """
 
7
digraph G {
 
8
    a_1-> a_2 -> a_3 -> a_1;
 
9
}
 
10
"""
 
11
 
 
12
class InterfaceTest(unittest.TestCase):
 
13
    def test_default(self):
 
14
        source = dot2tex.dot2tex(testgraph)
 
15
        self.failUnless(source.strip())
 
16
        
 
17
    def test_pgf(self):
 
18
        source = dot2tex.dot2tex(testgraph,format='pgf')
 
19
        self.failUnless(source.strip())
 
20
        
 
21
    def test_pstricks(self):
 
22
        source = dot2tex.dot2tex(testgraph,format='pst')
 
23
        self.failUnless(source.strip())
 
24
        
 
25
    def test_tikz(self):
 
26
        source = dot2tex.dot2tex(testgraph,format='tikz')
 
27
        self.failUnless(source.strip())
 
28
        
 
29
    def test_debug(self):
 
30
        """Is StringIO logging working?"""
 
31
        source = dot2tex.dot2tex(testgraph,debug=True)
 
32
        self.failUnless(dot2tex.get_logstream().getvalue().strip())
 
33
 
 
34
 
 
35
 
 
36
class UnicodeTest(unittest.TestCase):
 
37
    def test_russian(self):
 
38
        testgraph = """digraph {AAA [label="ЯЯЯ"];}"""
 
39
        source = dot2tex.dot2tex(testgraph,debug=True,format='tikz',codeonly=True)
 
40
        self.failUnless(source.find("{ЯЯЯ}") > 0,"Found %s" % source)
 
41
    def test_russian2(self):
 
42
        testgraph = """digraph {AAA [label=aaЯЯЯ];}"""
 
43
        source = dot2tex.dot2tex(testgraph,debug=True,format='tikz',codeonly=True)
 
44
        self.failUnless(source.find("{aaЯЯЯ}") > 0,"Found %s" % source)
 
45
    
 
46
 
 
47
if __name__ == '__main__':
 
48
    unittest.main()
 
49
    #import unicodedata
 
50
    #dd = u'Я'
 
51
    #print dd
 
52
    #print unicodedata.numeric(dd[0])
 
53
 
 
54
    #print ord(u'Я')
 
 
b'\\ No newline at end of file'