예제 #1
0
파일: test_parser.py 프로젝트: crs4/hl7apy
 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')
예제 #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')
예제 #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')
예제 #4
0
파일: test_parser.py 프로젝트: crs4/hl7apy
 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')
예제 #5
0
파일: test_parser.py 프로젝트: crs4/hl7apy
 def test_parse_null_fields(self):
     fields = 'PID|||'
     f = parse_fields(fields)
     self.assertEqual(len(f), 4)
예제 #6
0
파일: test_parser.py 프로젝트: crs4/hl7apy
 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')
예제 #7
0
 def test_parse_null_fields(self):
     fields = 'PID|||'
     f = parse_fields(fields)
     self.assertEqual(len(f), 4)
예제 #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')