Skip to content

Instantly share code, notes, and snippets.

@hodgestar
Created October 17, 2011 06:23
Show Gist options
  • Save hodgestar/1292050 to your computer and use it in GitHub Desktop.
Save hodgestar/1292050 to your computer and use it in GitHub Desktop.
Wrapping large blocks of text in which whitespace is important
class WikipediaTestCase(TestCase):
def setUp(self):
self.sample_xml = ("""<?xml version="1.0"?>
<SearchSuggestion xmlns="http://opensearch.org/searchsuggest2"
version="2.0">
<Query xml:space="preserve">africa</Query>
<Section>
<Item>
<Text xml:space="preserve">Africa</Text>
<Description xml:space="preserve">Africa is the world's"""
""" second largest and second most populous"""
""" continent, after Asia. </Description>
<Url xml:space="preserve">"""
"""http://en.wikipedia.org/wiki/Africa</Url>
<Image source="http://upload.wikimedia.org/wikipedia/"""
"""commons/thumb/8/86/Africa_%28orthographic_"""
"""projection%29.svg/50px-Africa_%28orthographic"""
"""_projection%29.svg.png" width="50" height="50"/>
</Item>
<Item>
<Text xml:space="preserve">Race and ethnicity in the"""
""" United States Census</Text>
<Description xml:space="preserve">Race and ethnicity in"""
""" the United States Census, as defined by the"""
""" Federal Office of Management and Budget (OMB)"""
""" and the United States Census Bureau, are"""
""" self-identification data items in which"""
""" residents choose the race or races with"""
""" which they most closely identify, and indicate"""
""" whether or not they are of Hispanic or Latino"""
""" origin (ethnicity).
</Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/"""
"""Race_and_ethnicity_in_the_United_States_"""
"""Census</Url>
</Item>
<Item>
<Text xml:space="preserve">African American</Text>
<Description xml:space="preserve">African Americans"""
""" (also referred to as Black Americans or"""
""" Afro-Americans, and formerly as American"""
""" Negroes) are citizens or residents of the"""
""" United States who have origins in any of the"""
""" black populations of Africa. </Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/"""
"""African_American</Url>
<Image source="http://upload.wikimedia.org/wikipedia/"""
"""commons/thumb/4/42/Jesse_Owens1.jpg/36px-Jesse"""
"""_Owens1.jpg" width="36" height="49"/>
</Item>
<Item>
<Text xml:space="preserve">African people</Text>
<Description xml:space="preserve">African people refers"""
""" to natives, inhabitants, or citizen of Africa"""
""" and to people of African descent. </Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/"""
"""African_people</Url>
</Item>
</Section>
</SearchSuggestion>""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment