Ejemplo n.º 1
0
 def test_parse_fields(self):
     # note: this method seems not to work without segment definition, and also for MSH segment
     field = 'PID|xxx|yyy^zz'
     fields = parse_fields(field)
     for field in fields:
         self.assertEqual(field.classname, 'Field')
     self.assertEqual(fields[0].to_er7(), 'PID')
     self.assertEqual(fields[1].to_er7(), 'xxx')
Ejemplo n.º 2
0
 def test_parse_fields(self):
     # note: this method seems not to work without segment definition, and also for MSH segment
     field = 'PID|xxx|yyy^zz'
     fields = parse_fields(field)
     for field in fields:
         self.assertEqual(field.classname, 'Field')
     self.assertEqual(fields[0].to_er7(), 'PID')
     self.assertEqual(fields[1].to_er7(), 'xxx')
Ejemplo n.º 3
0
 def test_parse_fields_custom_encoding_chars(self):
     fields = 'xxx@yyy$zz'
     f = parse_fields(fields,
                      encoding_chars=self._get_custom_encoding_chars())
     self.assertEqual(
         f[0].to_er7(encoding_chars=self._get_custom_encoding_chars()),
         'xxx')
     self.assertEqual(f[1].children[0].to_er7(), 'yyy')
Ejemplo n.º 4
0
 def test_parse_fields_custom_encoding_chars(self):
     fields = 'xxx@yyy$zz'
     f = parse_fields(fields, encoding_chars=self._get_custom_encoding_chars())
     self.assertEqual(f[0].to_er7(encoding_chars=self._get_custom_encoding_chars()), 'xxx')
     self.assertEqual(f[1].children[0].to_er7(), 'yyy')
Ejemplo n.º 5
0
 def test_parse_null_fields(self):
     fields = 'PID|||'
     f = parse_fields(fields)
     self.assertEqual(len(f), 4)
Ejemplo n.º 6
0
 def test_parse_fields_multiple_instances(self):
     field = '||@PID.3.1^aaaa^[email protected]^F'
     f = parse_fields(field, name_prefix='PID')
     self.assertEqual(len(f), 2)  # only the valued field is recognized
     self.assertEqual(f[0].cx_1.to_er7(), '@PID.3.1')
Ejemplo n.º 7
0
 def test_parse_null_fields(self):
     fields = 'PID|||'
     f = parse_fields(fields)
     self.assertEqual(len(f), 4)
Ejemplo n.º 8
0
 def test_parse_fields_multiple_instances(self):
     field = '||@PID.3.1^aaaa^[email protected]^F'
     f = parse_fields(field, name_prefix='PID')
     self.assertEqual(len(f), 2)  # only the valued field is recognized
     self.assertEqual(f[0].cx_1.to_er7(), '@PID.3.1')