|
1 |
| -from testutils import assert_raises, AssertRaises, skip_if_unsupported |
| 1 | +from testutils import assert_raises, AssertRaises |
2 | 2 |
|
3 | 3 | assert "".__eq__(1) == NotImplemented
|
4 | 4 | assert "a" == 'a'
|
@@ -471,73 +471,3 @@ def try_mutate_str():
|
471 | 471 | assert '{:e}'.format(float('inf')) == 'inf'
|
472 | 472 | assert '{:e}'.format(float('-inf')) == '-inf'
|
473 | 473 | assert '{:E}'.format(float('inf')) == 'INF'
|
474 |
| - |
475 |
| - |
476 |
| -# remove*fix test |
477 |
| -def test_removeprefix(): |
478 |
| - s='foobarfoo' |
479 |
| - s_ref='foobarfoo' |
480 |
| - assert s.removeprefix('f') == s_ref[1:] |
481 |
| - assert s.removeprefix('fo') == s_ref[2:] |
482 |
| - assert s.removeprefix('foo') == s_ref[3:] |
483 |
| - |
484 |
| - assert s.removeprefix('') == s_ref |
485 |
| - assert s.removeprefix('bar') == s_ref |
486 |
| - assert s.removeprefix('lol') == s_ref |
487 |
| - assert s.removeprefix('_foo') == s_ref |
488 |
| - assert s.removeprefix('-foo') == s_ref |
489 |
| - assert s.removeprefix('afoo') == s_ref |
490 |
| - assert s.removeprefix('*foo') == s_ref |
491 |
| - |
492 |
| - assert s==s_ref, 'undefined test fail' |
493 |
| - |
494 |
| -def test_removeprefix_types(): |
495 |
| - s='0123456' |
496 |
| - s_ref='0123456' |
497 |
| - others=[0,['012']] |
498 |
| - found=False |
499 |
| - for o in others: |
500 |
| - try: |
501 |
| - s.removeprefix(o) |
502 |
| - except: |
503 |
| - found=True |
504 |
| - |
505 |
| - assert found, f'Removeprefix accepts other type: {type(o)}: {o=}' |
506 |
| - |
507 |
| -def test_removesuffix(): |
508 |
| - s='foobarfoo' |
509 |
| - s_ref='foobarfoo' |
510 |
| - assert s.removesuffix('o') == s_ref[:-1] |
511 |
| - assert s.removesuffix('oo') == s_ref[:-2] |
512 |
| - assert s.removesuffix('foo') == s_ref[:-3] |
513 |
| - |
514 |
| - assert s.removesuffix('') == s_ref |
515 |
| - assert s.removesuffix('bar') == s_ref |
516 |
| - assert s.removesuffix('lol') == s_ref |
517 |
| - assert s.removesuffix('foo_') == s_ref |
518 |
| - assert s.removesuffix('foo-') == s_ref |
519 |
| - assert s.removesuffix('foo*') == s_ref |
520 |
| - assert s.removesuffix('fooa') == s_ref |
521 |
| - |
522 |
| - assert s==s_ref, 'undefined test fail' |
523 |
| - |
524 |
| -def test_removesuffix_types(): |
525 |
| - s='0123456' |
526 |
| - s_ref='0123456' |
527 |
| - others=[0,6,['6']] |
528 |
| - found=False |
529 |
| - for o in others: |
530 |
| - try: |
531 |
| - s.removesuffix(o) |
532 |
| - except: |
533 |
| - found=True |
534 |
| - |
535 |
| - assert found, f'Removesuffix accepts other type: {type(o)}: {o=}' |
536 |
| - |
537 |
| - |
538 |
| -skip_if_unsupported(3,9,test_removeprefix) |
539 |
| -skip_if_unsupported(3,9,test_removeprefix_types) |
540 |
| -skip_if_unsupported(3,9,test_removesuffix) |
541 |
| -skip_if_unsupported(3,9,test_removesuffix_types) |
542 |
| - |
543 |
| - |
0 commit comments