annotate tests/test_split.py @ 50:1284c99a94fa

stubbing
author Jeff Hammel <k0scist@gmail.com>
date Sat, 16 May 2015 21:02:07 -0700
parents 643c8e92e71e
children c3b69728f291
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 """
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 unit tests for `textshaper.split`
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 """
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 # imports
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 import unittest
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 from textshaper import split
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 class SplitUnitTest(unittest.TestCase):
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 def test_findall(self):
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 """test basic"""
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17
49
Jeff Hammel <k0scist@gmail.com>
parents: 48
diff changeset
18 # 012345678901
Jeff Hammel <k0scist@gmail.com>
parents: 48
diff changeset
19 string = 'a cat, a bat'
48
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20
49
Jeff Hammel <k0scist@gmail.com>
parents: 48
diff changeset
21 retval = split.findall(string, 'a')
50
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
22 self.assertEqual(retval, [0,3,7,10])
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
23
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
24 self.assertEqual(split.findall(string, 't'),
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
25 [4, 11])
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
26
1284c99a94fa stubbing
Jeff Hammel <k0scist@gmail.com>
parents: 49
diff changeset
27
48
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
28 if __name__ == '__main__':
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
29 unittest.main()
03ce88daa98d start test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
30