~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to jptools/jpBrailleRunner.py

  • Committer: Takuya Nishimoto
  • Date: 2013-03-05 16:29:40 UTC
  • Revision ID: nishimotz@gmail.com-20130305162940-9l24l87bpuy7lfql
refactored. added outposTest (-o) which currently raises assertion error

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
                                          type="int",
220
220
                                          default=1,
221
221
                                          help="number for timeit")
 
222
        parser.add_option("-o", "--outposTest",
 
223
                                          action="store_true",
 
224
                                          dest="outpos_test",
 
225
                                          default=False,
 
226
                                          help="outpos test")
222
227
        (options, args) = parser.parse_args()
223
228
 
224
 
        if options.make_doc == True:
 
229
        if options.outpos_test == True:
 
230
                # translate([b'louis/tables/en-us-g2.ctb'], 'Hello world!')
 
231
                inPos  = [0, 0, 1, 2, 3, 4, 5, 6, 6, 11]
 
232
                inlen  = len('Hello world!')
 
233
                outlen = len(',hello _w6')
 
234
                outPos = translator2.makeOutPos(inPos, inlen, outlen)
 
235
                print outPos 
 
236
                assert outPos == [1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 9]
 
237
        elif options.make_doc == True:
225
238
                make_doc()
226
239
        elif options.pass1_only == True:
227
240
                t = timeit.Timer(stmt=pass1)