<s> """<STR_LIT>""" <EOL> from textwrap import dedent <EOL> from hyde . generator import Generator <EOL> from hyde . site import Site <EOL> from fswrap import File <EOL> TEST_SITE = File ( __file__ ) . parent . parent . child_folder ( '<STR_LIT>' ) <EOL> class TestPaginator ( object ) : <EOL> def setUp ( self ) : <EOL> TEST_SITE . make ( ) <EOL> TEST_SITE . parent . child_folder ( <EOL> '<STR_LIT>' ) . copy_contents_to ( TEST_SITE ) <EOL> self . s = Site ( TEST_SITE ) <EOL> self . deploy = TEST_SITE . child_folder ( '<STR_LIT>' ) <EOL> self . gen = Generator ( self . s ) <EOL> self . gen . load_site_if_needed ( ) <EOL> self . gen . load_template_if_needed ( ) <EOL> self . gen . generate_all ( ) <EOL> def tearDown ( self ) : <EOL> TEST_SITE . delete ( ) <EOL> def test_page_no_paginator ( self ) : <EOL> f = File ( self . deploy . child ( '<STR_LIT>' ) ) <EOL> assert f . exists <EOL> def test_pages_of_one ( self ) : <EOL> pages = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> files = [ File ( self . deploy . child ( p ) ) for p in pages ] <EOL> for f in files : <EOL> assert f . exists <EOL> page5 = File ( self . deploy . child ( '<STR_LIT>' ) ) <EOL> assert not page5 . exists <EOL> def test_pages_of_one_content ( self ) : <EOL> expected_page1_content = dedent ( '''<STR_LIT>''' ) <EOL> expected_page2_content = dedent ( '''<STR_LIT>''' ) <EOL> expected_page3_content = dedent ( '''<STR_LIT>''' ) <EOL> expected_page4_content = dedent ( '''<STR_LIT>''' ) <EOL> page1 = self . deploy . child ( '<STR_LIT>' ) <EOL> content = File ( page1 ) . read_all ( ) <EOL> assert expected_page1_content == content <EOL> page2 = self . deploy . child ( '<STR_LIT>' ) <EOL> content = File ( page2 ) . read_all ( ) <EOL> assert expected_page2_content == content <EOL> page3 = self . deploy . child ( '<STR_LIT>' ) <EOL> content = File ( page3 ) . read_all ( ) <EOL> assert expected_page3_content == content <EOL> page4 = self . deploy . child ( '<STR_LIT>' ) <EOL> content = File ( page4 ) . read_all ( ) <EOL> assert expected_page4_content == content <EOL> def test_pages_of_ten ( self ) : <EOL> page1 = self . deploy . child ( '<STR_LIT>' ) <EOL> page2 = self . deploy . child ( '<STR_LIT>' ) <EOL> assert File ( page1 ) . exists <EOL> assert not File ( page2 ) . exists <EOL> def test_pages_of_ten_depends ( self ) : <EOL> depends = self . gen . deps [ '<STR_LIT>' ] <EOL> assert depends <EOL> assert len ( depends ) == <NUM_LIT:4> <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> def test_pages_of_ten_content ( self ) : <EOL> expected_content = dedent ( '''<STR_LIT>''' ) <EOL> page = self . deploy . child ( '<STR_LIT>' ) <EOL> content = File ( page ) . read_all ( ) <EOL> assert expected_content == content <EOL> def test_pages_of_one_depends ( self ) : <EOL> depends = self . gen . deps [ '<STR_LIT>' ] <EOL> assert depends <EOL> assert len ( depends ) == <NUM_LIT:4> <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> assert '<STR_LIT>' in depends <EOL> def test_custom_file_pattern ( self ) : <EOL> page1 = self . deploy . child ( '<STR_LIT>' ) <EOL> page2 = self . deploy . child ( '<STR_LIT>' ) <EOL> assert File ( page1 ) . exists <EOL> assert File ( page2 ) . exists </s>
