How to use the hl7apy.base_datatypes.FT function in hl7apy

To help you get started, we’ve selected a few hl7apy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_subcomponent_escape(self):
        ft = FT('&subcomponent&')
        self.assertEqual(ft.to_er7(), '\\T\\subcomponent\\T\\')
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_maxlength(self):
        ft_str = 'a' * (FT(' ').max_length + 1)
        FT(ft_str)  # no exception is raised here
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_repetition_escape(self):
        ft = FT('~repetition~')
        self.assertEqual(ft.to_er7(), '\\R\\repetition\\R\\')
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT(self):
        text = 'This is a FT datatype text'
        ft = FT(text)
        self.assertEqual(ft.classname, 'FT')
        self.assertEqual(ft.to_er7(), text)
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_field_escaping(self):
        ft = FT('|field|')
        self.assertEqual(ft.to_er7(), '\\F\\field\\F\\')
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_maxlength_strict(self):
        ft = 'a' * (FT(' ').max_length + 1)
        self.assertRaises(MaxLengthReached, FT, ft, validation_level=VALIDATION_LEVEL.STRICT)
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_component_escape(self):
        ft = FT('^component^')
        self.assertEqual(ft.to_er7(), '\\S\\component\\S\\')
github crs4 / hl7apy / tests / test_datatypes.py View on Github external
def test_FT_invalid_highlight_range(self):
        ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (4, 24)))
        self.assertRaises(InvalidHighlightRange, ft.to_er7)
        ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((4, 24), (0, 11)))
        self.assertRaises(InvalidHighlightRange, ft.to_er7)
        ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((5, 11), (0, 11)))
        self.assertRaises(InvalidHighlightRange, ft.to_er7)
        ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (0, 4)))
        self.assertRaises(InvalidHighlightRange, ft.to_er7)
github crs4 / hl7apy / hl7apy / base_datatypes.py View on Github external
def __init__(self, value, highlights=None,
                 validation_level=None):
        super(FT, self).__init__(value, 65536, highlights, validation_level)