예제 #1
0
 def test_height(self):
     """ make sure the attr string has only height if that is all that is given """
     attr_dict = dict(src="http://path.jpg", width="", height="23")
     attr_str = get_attr_string(attr_dict)
     self.assertTrue('height="23"' in attr_str)
     self.assertFalse('width' in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #2
0
 def test_neither(self):
     """ make sure the empty string is returned if that is all that is given"""
     attr_dict = dict(src="http://path.jpg", width="", height="")
     attr_str = get_attr_string(attr_dict)
     self.assertFalse('width' in attr_str)
     self.assertFalse('height' in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #3
0
 def test_both(self):
     """ make sure the attr string has both if both are given """
     attr_dict = dict(src="http://path.jpg", width="10", height="20")
     attr_str = get_attr_string(attr_dict)
     self.assertTrue('width="10"' in attr_str)
     self.assertTrue('height="20"' in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #4
0
 def test_neither(self):
     """ make sure the empty string is returned if that is all that is given"""
     attr_dict = dict(src="http://path.jpg", width="", height="")
     attr_str = get_attr_string(attr_dict)
     self.assertFalse("width" in attr_str)
     self.assertFalse("height" in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #5
0
 def test_height(self):
     """ make sure the attr string has only height if that is all that is given """
     attr_dict = dict(src="http://path.jpg", width="", height="23")
     attr_str = get_attr_string(attr_dict)
     self.assertTrue('height="23"' in attr_str)
     self.assertFalse("width" in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #6
0
 def test_both(self):
     """ make sure the attr string has both if both are given """
     attr_dict = dict(src="http://path.jpg", width="10", height="20")
     attr_str = get_attr_string(attr_dict)
     self.assertTrue('width="10"' in attr_str)
     self.assertTrue('height="20"' in attr_str)
     self.assertTrue('src="http://path.jpg"' in attr_str)
예제 #7
0
 def render(self, context):
     return get_attr_string(self.img_var.resolve(context))
예제 #8
0
 def render(self, context):
     return get_attr_string(self.img_var.resolve(context))