def test_two_refs(self): test_string = "This is a %s test of %s expansion." unexpanded = test_string % ("{{%s}}", "{{%s}}") % ( TestSnippets.snippet1_name, TestSnippets.snippet2_name) expected_expansion = test_string % (TestSnippets.snippet1_content, TestSnippets.snippet2_content) result = Snippet.expand(unexpanded) self.assertEqual(result, expected_expansion)
def test_bad_ref(self): test_string = "This is a test of %s expansion." unexpanded = test_string % "{{%s}}" % "badname" expected_expansion = test_string % Snippet.BAD_SNIPPET_REF_STR result = Snippet.expand(unexpanded) self.assertEqual(result, expected_expansion)
def test_one_ref(self): test_string = "This is a test of %s expansion." unexpanded = test_string % "{{%s}}" % TestSnippets.snippet1_name expected_expansion = test_string % TestSnippets.snippet1_content result = Snippet.expand(unexpanded) self.assertEqual(result, expected_expansion)
def test_zero_refs(self): test_string = "This is a test of expansion." result = Snippet.expand(test_string) self.assertEqual(result, test_string)
def test_two_refs(self): test_string = "This is a %s test of %s expansion." unexpanded = test_string % ("{{%s}}", "{{%s}}") % (TestSnippets.snippet1_name, TestSnippets.snippet2_name) expected_expansion = test_string % (TestSnippets.snippet1_content, TestSnippets.snippet2_content) result = Snippet.expand(unexpanded) self.assertEqual(result, expected_expansion)