Ticket #193: python-testcase-for-bug-193.patch

File python-testcase-for-bug-193.patch, 0.8 kB (added by olly, 16 months ago)

Patch to smoketest.py to show this bug for Python

  • smoketest.py

     
    275275    termgen.index_text('foo bar baz foo') 
    276276    expect([(item.term, item.wdf, [pos for pos in item.positer]) for item in doc.termlist()], [('bar', 1, [2]), ('baz', 1, [3]), ('foo', 2, [1, 4])]) 
    277277 
     278    # Regression test for bug#193, fixed in 1.0.3. 
     279    vrp = xapian.NumberValueRangeProcessor(0, '$', True) 
     280    a = '$10' 
     281    b = '20' 
     282    vrp(a, b) 
     283    if xapian.sortable_unserialise(a) != 10: 
     284        print "%d != 10\n" % xapian.sortable_unserialise(a) 
     285        sys.exit(1) 
     286    if xapian.sortable_unserialise(b) != 20: 
     287        print "%d != 20\n" % xapian.sortable_unserialise(b) 
     288 
    278289# Run all tests (ie, callables with names starting "test_"). 
    279290if not runtests(globals()): 
    280291    sys.exit(1)