def test_new_value_percentage2(self): parser = SVGParser() root = parser.create_element('svg') group = root.create_sub_element('g') group.attributes.update({ 'font-size': '16', }) a = SVGLength(context=group) a.new_value(92.00042345, SVGLength.TYPE_PERCENTAGE) self.assertEqual(92.00042345, a.value(SVGLength.TYPE_PERCENTAGE)) self.assertEqual('%', a.unit) self.assertEqual('92%', a.tostring())
def test_new_value_percentage(self): a = SVGLength() a.new_value(92.00042345, SVGLength.TYPE_PERCENTAGE) self.assertEqual(92.00042345, a.value(SVGLength.TYPE_PERCENTAGE)) self.assertEqual('%', a.unit) self.assertEqual('92%', a.tostring())
def test_new_value_number(self): a = SVGLength() a.new_value(1.0001, SVGLength.TYPE_NUMBER) self.assertEqual(1.0001, a.value()) self.assertIsNone(a.unit) self.assertEqual('1', a.tostring())