def test_keeps_non_tag_text_after_dash(self): self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Pumpkin Seed Bark – Dark Chocolate and Sea Salt</h1>""" )), u'Pumpkin Seed Bark \u2013 Dark Chocolate and Sea Salt') self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Keto Flatbread Recipe – Low Carb, Gluten Free</h1>""" )), u'Keto Flatbread Recipe')
def test_strips_bracketed_text(self): self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Low Carb Moscow Mule – [Keto, Alcohol, Sugar Free]</h1>""" )), 'Low Carb Moscow Mule')
def test_strips_tags_after_dash(self): self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Spicy Chicken Sausage – Low Carb, Gluten-Free</h1>""" )), u'Spicy Chicken Sausage')
def test_strips_tags_after_pipe(self): self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Spanish Cauliflower Rice | Low Carb</h1>""")), 'Spanish Cauliflower Rice')
def test_strips_tags_after_colon(self): self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Vodka Mojito: Low Carb and Sugar-Free</h1>""")), 'Vodka Mojito') self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Hot Buttered Rum Recipe: Low Carb, Sugar Free</h1>""") ), 'Hot Buttered Rum Recipe') self.assertEqual( ketogasm.scrape_title( http.TextResponse(url='', body=""" <h1 class="entry-title">Gin Fizz Cocktail Recipe – Low Carb & Sugar Free!</h1> """)), 'Gin Fizz Cocktail Recipe')