@@ -369,15 +369,21 @@ def test_left_text_multiline():
369
369
assert aligned == ('foo----\n '
370
370
'shoes--' )
371
371
372
- def test_left_text_asian_fill ():
373
- """Test fill_char with display width greater than 1"""
372
+ def test_left_wide_display_text ():
373
+ text = '苹'
374
+ fill_char = '-'
375
+ width = 4
376
+ aligned = cu .ljustify_text (text , fill_char = fill_char , width = width )
377
+ assert aligned == text + fill_char + fill_char
378
+
379
+ def test_left_text_wide_display_fill ():
374
380
text = 'foo'
375
381
fill_char = '苹'
376
382
width = 5
377
383
aligned = cu .ljustify_text (text , fill_char = fill_char , width = width )
378
384
assert aligned == text + fill_char
379
385
380
- def test_left_text_asian_fill_needs_padding ():
386
+ def test_left_text_wide_display_fill_needs_padding ():
381
387
"""Test when fill_char's display width does not divide evenly into gap"""
382
388
text = 'foo'
383
389
fill_char = '苹'
@@ -400,23 +406,29 @@ def test_center_text_multiline():
400
406
assert aligned == ('--foo--\n '
401
407
'-shoes-' )
402
408
403
- def test_center_text_asian_fill ():
404
- """Test fill_char with display width greater than 1"""
409
+ def test_center_wide_display_text ():
410
+ text = '苹'
411
+ fill_char = '-'
412
+ width = 4
413
+ aligned = cu .center_text (text , fill_char = fill_char , width = width )
414
+ assert aligned == fill_char + text + fill_char
415
+
416
+ def test_center_text_wide_display_fill ():
405
417
text = 'foo'
406
418
fill_char = '苹'
407
419
width = 7
408
420
aligned = cu .center_text (text , fill_char = fill_char , width = width )
409
421
assert aligned == fill_char + text + fill_char
410
422
411
- def test_center_text_asian_fill_needs_right_padding ():
423
+ def test_center_text_wide_display_fill_needs_right_padding ():
412
424
"""Test when fill_char's display width does not divide evenly into right gap"""
413
425
text = 'foo'
414
426
fill_char = '苹'
415
427
width = 8
416
428
aligned = cu .center_text (text , fill_char = fill_char , width = width )
417
429
assert aligned == fill_char + text + fill_char + ' '
418
430
419
- def test_center_text_asian_fill_needs_left_and_right_padding ():
431
+ def test_center_text_wide_display_fill_needs_left_and_right_padding ():
420
432
"""Test when fill_char's display width does not divide evenly into either gap"""
421
433
text = 'foo'
422
434
fill_char = '苹'
@@ -439,15 +451,21 @@ def test_right_text_multiline():
439
451
assert aligned == ('----foo\n '
440
452
'--shoes' )
441
453
442
- def test_right_text_asian_fill ():
443
- """Test fill_char with display width greater than 1"""
454
+ def test_right_wide_display_text ():
455
+ text = '苹'
456
+ fill_char = '-'
457
+ width = 4
458
+ aligned = cu .rjustify_text (text , fill_char = fill_char , width = width )
459
+ assert aligned == fill_char + fill_char + text
460
+
461
+ def test_right_text_wide_display_fill ():
444
462
text = 'foo'
445
463
fill_char = '苹'
446
464
width = 5
447
465
aligned = cu .rjustify_text (text , fill_char = fill_char , width = width )
448
466
assert aligned == fill_char + text
449
467
450
- def test_right_text_asian_fill_needs_padding ():
468
+ def test_right_text_wide_display_fill_needs_padding ():
451
469
"""Test when fill_char's display width does not divide evenly into gap"""
452
470
text = 'foo'
453
471
fill_char = '苹'
0 commit comments