Code Duplication    Length = 12-12 lines in 6 locations

elodie/tests/filesystem_test.py 6 locations

@@ 673-684 (lines=12) @@
670
671
    assert path == 'California', path
672
673
def test_parse_folder_name_multiple_keys_not_found():
674
    if hasattr(load_config, 'config'):
675
        del load_config.config
676
    filesystem = FileSystem()
677
    place_name = {'default': u'United States of America', 'country': u'United States of America'}
678
    mask = '%city-%state'
679
    location_parts = re.findall('(%[^%]+)', mask)
680
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
681
    if hasattr(load_config, 'config'):
682
        del load_config.config
683
684
    assert path == 'United States of America', path
685
686
def test_process_file_invalid():
687
    filesystem = FileSystem()
@@ 660-671 (lines=12) @@
657
658
    assert path == 'California', path
659
660
def test_parse_folder_name_key_not_found_with_static_chars():
661
    if hasattr(load_config, 'config'):
662
        del load_config.config
663
    filesystem = FileSystem()
664
    place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California'}
665
    mask = '%city-is-not-found'
666
    location_parts = re.findall('(%[^%]+)', mask)
667
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
668
    if hasattr(load_config, 'config'):
669
        del load_config.config
670
671
    assert path == 'California', path
672
673
def test_parse_folder_name_multiple_keys_not_found():
674
    if hasattr(load_config, 'config'):
@@ 647-658 (lines=12) @@
644
645
    assert path == 'Sunnyvale-is-the-city', path
646
647
def test_parse_folder_name_key_not_found():
648
    if hasattr(load_config, 'config'):
649
        del load_config.config
650
    filesystem = FileSystem()
651
    place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California'}
652
    mask = '%city'
653
    location_parts = re.findall('(%[^%]+)', mask)
654
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
655
    if hasattr(load_config, 'config'):
656
        del load_config.config
657
658
    assert path == 'California', path
659
660
def test_parse_folder_name_key_not_found_with_static_chars():
661
    if hasattr(load_config, 'config'):
@@ 634-645 (lines=12) @@
631
632
    assert path == 'Sunnyvale-California-United States of America', path
633
634
def test_parse_folder_name_static_chars():
635
    if hasattr(load_config, 'config'):
636
        del load_config.config
637
    filesystem = FileSystem()
638
    place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'}
639
    mask = '%city-is-the-city'
640
    location_parts = re.findall('(%[^%]+)', mask)
641
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
642
    if hasattr(load_config, 'config'):
643
        del load_config.config
644
645
    assert path == 'Sunnyvale-is-the-city', path
646
647
def test_parse_folder_name_key_not_found():
648
    if hasattr(load_config, 'config'):
@@ 621-632 (lines=12) @@
618
619
    assert path == 'Sunnyvale', path
620
621
def test_parse_folder_name_multiple():
622
    if hasattr(load_config, 'config'):
623
        del load_config.config
624
    filesystem = FileSystem()
625
    place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'}
626
    mask = '%city-%state-%country'
627
    location_parts = re.findall('(%[^%]+)', mask)
628
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
629
    if hasattr(load_config, 'config'):
630
        del load_config.config
631
632
    assert path == 'Sunnyvale-California-United States of America', path
633
634
def test_parse_folder_name_static_chars():
635
    if hasattr(load_config, 'config'):
@@ 608-619 (lines=12) @@
605
606
    assert path == os.path.join('2015-12-Dec','Sunnyvale'), path
607
608
def test_parse_folder_name_default():
609
    if hasattr(load_config, 'config'):
610
        del load_config.config
611
    filesystem = FileSystem()
612
    place_name = {'default': u'California', 'country': u'United States of America', 'state': u'California', 'city': u'Sunnyvale'}
613
    mask = '%city'
614
    location_parts = re.findall('(%[^%]+)', mask)
615
    path = filesystem.parse_mask_for_location(mask, location_parts, place_name)
616
    if hasattr(load_config, 'config'):
617
        del load_config.config
618
619
    assert path == 'Sunnyvale', path
620
621
def test_parse_folder_name_multiple():
622
    if hasattr(load_config, 'config'):