<s> """<STR_LIT>""" <EOL> from six import PY3 <EOL> from util import TestApp , remove_unicode_literals , path <EOL> from sphinx . builders . html import StandaloneHTMLBuilder <EOL> from sphinx . builders . latex import LaTeXBuilder <EOL> app = env = None <EOL> warnings = [ ] <EOL> def setup_module ( ) : <EOL> global app , env <EOL> app = TestApp ( srcdir = '<STR_LIT>' ) <EOL> env = app . env <EOL> env . set_warnfunc ( lambda * args : warnings . append ( args ) ) <EOL> def teardown_module ( ) : <EOL> app . cleanup ( ) <EOL> def warning_emitted ( file , text ) : <EOL> for warning in warnings : <EOL> if len ( warning ) == <NUM_LIT:2> and file in warning [ <NUM_LIT:1> ] and text in warning [ <NUM_LIT:0> ] : <EOL> return True <EOL> return False <EOL> def test_first_update ( ) : <EOL> updated = env . update ( app . config , app . srcdir , app . doctreedir , app ) <EOL> assert set ( updated ) == env . found_docs == set ( env . all_docs ) <EOL> assert '<STR_LIT>' not in env . found_docs <EOL> def test_images ( ) : <EOL> assert warning_emitted ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert warning_emitted ( '<STR_LIT>' , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> tree = env . get_doctree ( '<STR_LIT>' ) <EOL> app . _warning . reset ( ) <EOL> htmlbuilder = StandaloneHTMLBuilder ( app ) <EOL> htmlbuilder . imgpath = '<STR_LIT>' <EOL> htmlbuilder . post_process_images ( tree ) <EOL> image_uri_message = "<STR_LIT>" <EOL> if PY3 : <EOL> image_uri_message = remove_unicode_literals ( image_uri_message ) <EOL> assert image_uri_message in app . _warning . content [ - <NUM_LIT:1> ] <EOL> assert set ( htmlbuilder . images . keys ( ) ) == set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> assert set ( htmlbuilder . images . values ( ) ) == set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> app . _warning . reset ( ) <EOL> latexbuilder = LaTeXBuilder ( app ) <EOL> latexbuilder . post_process_images ( tree ) <EOL> assert image_uri_message in app . _warning . content [ - <NUM_LIT:1> ] <EOL> assert set ( latexbuilder . images . keys ( ) ) == set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert set ( latexbuilder . images . values ( ) ) == set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_second_update ( ) : <EOL> env . all_docs [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> root = path ( app . srcdir ) <EOL> ( root / '<STR_LIT>' ) . unlink ( ) <EOL> ( root / '<STR_LIT>' ) . write_text ( '<STR_LIT>' ) <EOL> updated = env . update ( app . config , app . srcdir , app . doctreedir , app ) <EOL> assert set ( updated ) == set ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> assert '<STR_LIT>' not in env . all_docs <EOL> assert '<STR_LIT>' not in env . found_docs <EOL> def test_env_read_docs ( ) : <EOL> """<STR_LIT>""" <EOL> def on_env_read_docs_1 ( app , env , docnames ) : <EOL> pass <EOL> app . connect ( '<STR_LIT>' , on_env_read_docs_1 ) <EOL> read_docnames = env . update ( app . config , app . srcdir , app . doctreedir , app ) <EOL> assert len ( read_docnames ) > <NUM_LIT:2> and read_docnames == sorted ( read_docnames ) <EOL> def on_env_read_docs_2 ( app , env , docnames ) : <EOL> docnames . remove ( '<STR_LIT>' ) <EOL> app . connect ( '<STR_LIT>' , on_env_read_docs_2 ) <EOL> read_docnames = env . update ( app . config , app . srcdir , app . doctreedir , app ) <EOL> assert len ( read_docnames ) == <NUM_LIT:2> <EOL> def test_object_inventory ( ) : <EOL> refs = env . domaindata [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> assert '<STR_LIT>' in refs <EOL> assert refs [ '<STR_LIT>' ] == ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' not in refs <EOL> assert '<STR_LIT>' in refs <EOL> assert '<STR_LIT>' not in refs <EOL> assert '<STR_LIT>' not in refs <EOL> assert env . domaindata [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] == ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , False ) <EOL> assert env . domains [ '<STR_LIT>' ] . data is env . domaindata [ '<STR_LIT>' ] <EOL> assert env . domains [ '<STR_LIT:c>' ] . data is env . domaindata [ '<STR_LIT:c>' ] </s>
