@@ -481,6 +481,37 @@ def test_convert_odml_file_value(self):
481
481
</value>
482
482
</property>
483
483
484
+ <property>
485
+ <value>Single, string, value, with, many, commata.<type>string</type></value>
486
+ <name>testSingleString</name>
487
+ </property>
488
+
489
+ <property>
490
+ <value>A<type>string</type></value>
491
+ <value>B<type>string</type></value>
492
+ <value>C<type>string</type></value>
493
+ <name>testStringList</name>
494
+ </property>
495
+
496
+ <property>
497
+ <value> Single string value with wrapping whitespace <type>string</type></value>
498
+ <name>testStringWhiteSpace</name>
499
+ </property>
500
+
501
+ <property>
502
+ <value> Multiple Strings <type>string</type></value>
503
+ <value> with wrapping <type>string</type></value>
504
+ <value> Whitespace <type>string</type></value>
505
+ <name>testStringListWhiteSpace</name>
506
+ </property>
507
+
508
+ <property>
509
+ <value> 1 <type>int</type></value>
510
+ <value> 2 <type>int</type></value>
511
+ <value> 3 <type>int</type></value>
512
+ <name>testIntListWhiteSpace</name>
513
+ </property>
514
+
484
515
</section>
485
516
</odML>
486
517
"""
@@ -490,7 +521,7 @@ def test_convert_odml_file_value(self):
490
521
conv_doc = vc ._convert (vc ._parse_xml ())
491
522
root = conv_doc .getroot ()
492
523
sec = root .find ("section" )
493
- self .assertEqual (len (sec ), 9 )
524
+ self .assertEqual (len (sec ), 14 )
494
525
495
526
# Test single value export
496
527
prop = sec .findall ("property" )[0 ]
@@ -541,6 +572,35 @@ def test_convert_odml_file_value(self):
541
572
self .assertEqual (prop .find ("name" ).text , "Unsupported binary value dtype replace" )
542
573
self .assertEqual (prop .find ("type" ).text , "text" )
543
574
575
+ # Test single string value with commata
576
+ prop = sec .findall ("property" )[8 ]
577
+ self .assertEqual (prop .find ("name" ).text , "testSingleString" )
578
+ self .assertEqual (prop .find ("value" ).text ,
579
+ "Single, string, value, with, many, commata." )
580
+
581
+ # Test string list import
582
+ prop = sec .findall ("property" )[9 ]
583
+ self .assertEqual (prop .find ("name" ).text , "testStringList" )
584
+ self .assertEqual (prop .find ("value" ).text , "[A,B,C]" )
585
+
586
+ # Test single string values wrapping whitespace removal
587
+ prop = sec .findall ("property" )[10 ]
588
+ self .assertEqual (prop .find ("name" ).text , "testStringWhiteSpace" )
589
+ self .assertEqual (prop .find ("value" ).text ,
590
+ "Single string value with wrapping whitespace" )
591
+
592
+ # Test multiple string values with wrapping whitespace removal
593
+ prop = sec .findall ("property" )[11 ]
594
+ self .assertEqual (prop .find ("name" ).text , "testStringListWhiteSpace" )
595
+ self .assertEqual (prop .find ("value" ).text ,
596
+ "[Multiple Strings,with wrapping,Whitespace]" )
597
+
598
+ # Test multiple int values with wrapping whitespaces
599
+ prop = sec .findall ("property" )[12 ]
600
+ self .assertEqual (prop .find ("name" ).text , "testIntListWhiteSpace" )
601
+ self .assertEqual (prop .find ("type" ).text , "int" )
602
+ self .assertEqual (prop .find ("value" ).text , "[1,2,3]" )
603
+
544
604
def test_parse_dict_document (self ):
545
605
# Test appending tags; not appending empty sections
546
606
doc_dict = {'Document' : {'author' : 'HPL' , 'sections' : []}}
0 commit comments