File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1444,6 +1444,24 @@ def test_guess_delimiter_crlf_not_chosen(self):
14441444 self .assertEqual (sniffer .sniff (sample ).delimiter , "|" )
14451445 self .assertNotEqual (sniffer .sniff (sample ).delimiter , "\r " )
14461446
1447+ def test_zero_mode_tie_order_independence (self ):
1448+ # ":" appears in half the rows (1, 0, 1, 0) - a tie between
1449+ # 0 and 1 per line.
1450+ # "," appears once every row (true delimiter).
1451+ #
1452+ # Even if the zero-frequency bucket is appended v. inserted, the tie
1453+ # yields an adjusted score of 0, so ":" should not be promoted and
1454+ # "," must be selected.
1455+ sample = (
1456+ "a,b:c\n "
1457+ "d,e\n "
1458+ "f,g:c\n "
1459+ "h,i\n "
1460+ )
1461+ sniffer = csv .Sniffer ()
1462+ dialect = sniffer .sniff (sample )
1463+ self .assertEqual (dialect .delimiter , "," )
1464+
14471465class NUL :
14481466 def write (s , * args ):
14491467 pass
You can’t perform that action at this time.
0 commit comments