Merge branch 'master' into preserve-order
commit
cf974fc136
|
@ -289,7 +289,7 @@ class Document:
|
|||
|
||||
# If given a list of strings (one or more), assume it represents
|
||||
# a sequence of nested group names
|
||||
elif all(isinstance(elem, str) for elem in group):
|
||||
elif len(group) > 0 and all(isinstance(elem, str) for elem in group):
|
||||
group = self.get_or_add_group(group)
|
||||
|
||||
elif not isinstance(group, Element):
|
||||
|
|
|
@ -235,4 +235,11 @@ class TestGroups(unittest.TestCase):
|
|||
|
||||
path = parse_path(path_d)
|
||||
svg_path = doc.add_path(path, group=new_leaf)
|
||||
self.assertEqual(path_d, svg_path.get('d'))
|
||||
self.assertEqual(path_d, svg_path.get('d'))
|
||||
|
||||
# Test that paths are added to the correct group
|
||||
new_sibling = doc.get_or_add_group(
|
||||
['base_group', 'new_parent', 'new_sibling'])
|
||||
doc.add_path(path, group=new_sibling)
|
||||
self.assertEqual(len(new_sibling), 1)
|
||||
self.assertEqual(path_d, new_sibling[0].get('d'))
|
||||
|
|
Loading…
Reference in New Issue