Code Duplication    Length = 13-14 lines in 9 locations

test/test_loader.py 9 locations

@@ 523-536 (lines=14) @@
520
    assert docs[1] == ['TestBot: hello']
521
522
523
def test_clean_callable_example_nickname_custom_prefix(tmpconfig, func):
524
    module.commands('test')(func)
525
    module.example('$nickname: hello')(func)
526
527
    tmpconfig.core.help_prefix = '!'
528
    loader.clean_callable(func, tmpconfig)
529
530
    assert len(func._docs) == 1
531
    assert 'test' in func._docs
532
533
    docs = func._docs['test']
534
    assert len(docs) == 2
535
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
536
    assert docs[1] == ['TestBot: hello']
537
538
539
def test_clean_callable_intents(tmpconfig, func):
@@ 492-505 (lines=14) @@
489
    assert docs[1] == ['.test bonjour']
490
491
492
def test_clean_callable_example_default_prefix(tmpconfig, func):
493
    module.commands('test')(func)
494
    module.example('.test hello')(func)
495
496
    tmpconfig.core.help_prefix = '!'
497
    loader.clean_callable(func, tmpconfig)
498
499
    assert len(func._docs) == 1
500
    assert 'test' in func._docs
501
502
    docs = func._docs['test']
503
    assert len(docs) == 2
504
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
505
    assert docs[1] == ['!test hello']
506
507
508
def test_clean_callable_example_nickname(tmpconfig, func):
@@ 476-489 (lines=14) @@
473
    assert docs[1] == ['.test hello', '.test bonjour']
474
475
476
def test_clean_callable_example_user_help_mixed(tmpconfig, func):
477
    module.commands('test')(func)
478
    module.example('.test hello')(func)
479
    module.example('.test bonjour', user_help=True)(func)
480
481
    loader.clean_callable(func, tmpconfig)
482
483
    assert len(func._docs) == 1
484
    assert 'test' in func._docs
485
486
    docs = func._docs['test']
487
    assert len(docs) == 2
488
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
489
    assert docs[1] == ['.test bonjour']
490
491
492
def test_clean_callable_example_default_prefix(tmpconfig, func):
@@ 460-473 (lines=14) @@
457
    assert docs[1] == ['.test hello']
458
459
460
def test_clean_callable_example_user_help_multi(tmpconfig, func):
461
    module.commands('test')(func)
462
    module.example('.test hello', user_help=True)(func)
463
    module.example('.test bonjour', user_help=True)(func)
464
465
    loader.clean_callable(func, tmpconfig)
466
467
    assert len(func._docs) == 1
468
    assert 'test' in func._docs
469
470
    docs = func._docs['test']
471
    assert len(docs) == 2
472
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
473
    assert docs[1] == ['.test hello', '.test bonjour']
474
475
476
def test_clean_callable_example_user_help_mixed(tmpconfig, func):
@@ 407-420 (lines=14) @@
404
    assert test_docs[1] == ['.test hello']
405
406
407
def test_clean_callable_example_first_only(tmpconfig, func):
408
    module.commands('test')(func)
409
    module.example('.test hello')(func)
410
    module.example('.test bonjour')(func)
411
412
    loader.clean_callable(func, tmpconfig)
413
414
    assert len(func._docs) == 1
415
    assert 'test' in func._docs
416
417
    docs = func._docs['test']
418
    assert len(docs) == 2
419
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
420
    assert docs[1] == ['.test hello']
421
422
423
def test_clean_callable_example_first_only_multi_commands(tmpconfig, func):
@@ 355-368 (lines=14) @@
352
    assert func.event == ['JOIN']
353
354
355
def test_clean_callable_example(tmpconfig, func):
356
    module.commands('test')(func)
357
    module.example('.test hello')(func)
358
359
    loader.clean_callable(func, tmpconfig)
360
361
    assert hasattr(func, '_docs')
362
    assert len(func._docs) == 1
363
    assert 'test' in func._docs
364
365
    docs = func._docs['test']
366
    assert len(docs) == 2
367
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
368
    assert docs[1] == ['.test hello']
369
370
371
def test_clean_callable_example_not_set(tmpconfig, func):
@@ 508-520 (lines=13) @@
505
    assert docs[1] == ['!test hello']
506
507
508
def test_clean_callable_example_nickname(tmpconfig, func):
509
    module.commands('test')(func)
510
    module.example('$nickname: hello')(func)
511
512
    loader.clean_callable(func, tmpconfig)
513
514
    assert len(func._docs) == 1
515
    assert 'test' in func._docs
516
517
    docs = func._docs['test']
518
    assert len(docs) == 2
519
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
520
    assert docs[1] == ['TestBot: hello']
521
522
523
def test_clean_callable_example_nickname_custom_prefix(tmpconfig, func):
@@ 445-457 (lines=13) @@
442
    assert test_docs[1] == ['.test hello']
443
444
445
def test_clean_callable_example_user_help(tmpconfig, func):
446
    module.commands('test')(func)
447
    module.example('.test hello', user_help=True)(func)
448
449
    loader.clean_callable(func, tmpconfig)
450
451
    assert len(func._docs) == 1
452
    assert 'test' in func._docs
453
454
    docs = func._docs['test']
455
    assert len(docs) == 2
456
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
457
    assert docs[1] == ['.test hello']
458
459
460
def test_clean_callable_example_user_help_multi(tmpconfig, func):
@@ 371-383 (lines=13) @@
368
    assert docs[1] == ['.test hello']
369
370
371
def test_clean_callable_example_not_set(tmpconfig, func):
372
    module.commands('test')(func)
373
374
    loader.clean_callable(func, tmpconfig)
375
376
    assert hasattr(func, '_docs')
377
    assert len(func._docs) == 1
378
    assert 'test' in func._docs
379
380
    docs = func._docs['test']
381
    assert len(docs) == 2
382
    assert docs[0] == inspect.cleandoc(func.__doc__).splitlines()
383
    assert docs[1] == []
384
385
386
def test_clean_callable_example_multi_commands(tmpconfig, func):