Back to index

python3.2  3.2.2
Public Member Functions
test.test_difflib.TestAutojunk Class Reference

List of all members.

Public Member Functions

def test_one_insert_homogenous_sequence

Detailed Description

Tests for the autojunk parameter added in 2.7

Definition at line 46 of file test_difflib.py.


Member Function Documentation

Definition at line 48 of file test_difflib.py.

00048 
00049     def test_one_insert_homogenous_sequence(self):
00050         # By default autojunk=True and the heuristic kicks in for a sequence
00051         # of length 200+
00052         seq1 = 'b' * 200
00053         seq2 = 'a' + 'b' * 200
00054 
00055         sm = difflib.SequenceMatcher(None, seq1, seq2)
00056         self.assertAlmostEqual(sm.ratio(), 0, places=3)
00057         self.assertEqual(sm.bpopular, {'b'})
00058 
00059         # Now turn the heuristic off
00060         sm = difflib.SequenceMatcher(None, seq1, seq2, autojunk=False)
00061         self.assertAlmostEqual(sm.ratio(), 0.9975, places=3)
00062         self.assertEqual(sm.bpopular, set())
00063 

Here is the call graph for this function:


The documentation for this class was generated from the following file: