def test_name_set_no_changes(self): """ Tests that the field name does not change for creating a new one """ field1 = basic.time(name='field1') field2 = basic.time(name='field2') self.assertEqual('field1', field1.name) self.assertEqual('field2', field2.name)
def test_name_set_no_changes(self): """ Tests that the field name does not change for creating a new one """ field1 = basic.time(name='field1') field2 = basic.time(name='field2') self.assertEqual('field1', field1.name) self.assertEqual('field2', field2.name)
def test_name_default(self): """ Tests that the default field name is correct for optional fields. """ field = basic.time() self.assertEqual('Time Field', field.name)
def test_name_default(self): """ Tests that the default field name is correct for optional fields. """ field = basic.time() self.assertEqual('Time Field', field.name)
def date_time(name=None): """ Creates the grammar for a date and time field, which is a combination of the Date (D) and Time or Duration field (T). This field requires first a Date, and then a Time, without any space in between. :param name: name for the field :return: grammar for a Date and Time field """ if name is None: name = 'Date and Time Field' date = basic.date('Date') time = basic.time('Time') date = date.setResultsName('date') time = time.setResultsName('time') field = pp.Group(date + time) field.setParseAction(lambda d: _combine_date_time(d[0])) field.setName(name) return field.setResultsName('date_time')
def test_name_default_compulsory(self): """ Tests that the default field name is correct for optional fields, for compulsory fields. """ field = basic.time(compulsory=True) self.assertEqual('Time Field', field.name)
def date_time(name=None): """ Creates the grammar for a date and time field, which is a combination of the Date (D) and Time or Duration field (T). This field requires first a Date, and then a Time, without any space in between. :param name: name for the field :return: grammar for a Date and Time field """ if name is None: name = 'Date and Time Field' date = basic.date('Date') time = basic.time('Time') date = date.setResultsName('date') time = time.setResultsName('time') field = pp.Group(date + time) field.setParseAction(lambda d: _combine_date_time(d[0])) field.setName(name) return field.setResultsName('date_time')
def test_name_set(self): """ Tests that the given field name is set correctly for optional fields. """ name = "Field Name" field = basic.time(name=name) self.assertEqual(name, field.name)
def test_name_set(self): """ Tests that the given field name is set correctly for optional fields. """ name = "Field Name" field = basic.time(name=name) self.assertEqual(name, field.name)
CWR Acknowledgement record fields grammar. """ __author__ = 'Bernardo Martínez Garrido' __license__ = 'MIT' __status__ = 'Development' # Acquires data sources _config = CWRConfiguration() # Creation Date creation_date = basic.date(compulsory=True) creation_date = creation_date.setName('Creation Date').setResultsName('creation_date') # Creation Time creation_time = basic.time(compulsory=True) creation_time = creation_time.setName('Creation Time').setResultsName('creation_time') # Original Group ID original_group_id = group.group_id original_group_id = original_group_id.setName('Original Group ID') # Original Transaction Sequence # original_transaction_sequence_n = basic.numeric(_config.field_size('acknowledgement', 'transaction_n'), compulsory=True) original_transaction_sequence_n = original_transaction_sequence_n.setName( 'Original Transaction Sequence #').setResultsName( 'original_transaction_sequence_n') # Creation Title creation_title = basic.alphanum(_config.field_size('acknowledgement', 'title')) creation_title = creation_title.setName('Creation Title').setResultsName('creation_title')
def get_field(self, name=None, columns=None, values=None): return basic.time(name)
def setUp(self): self.time = basic.time()
def get_field(self, name=None, columns=None, values=None): return basic.time(name)
def setUp(self): self.time = basic.time()
submitter_work_n = submitter_work_n.setName('Submitter Work Number').setResultsName('submitter_work_n') # ISWC iswc = special.iswc() iswc = iswc.setResultsName('iswc') # Copyright Date copyright_date = basic.date() copyright_date = copyright_date.setName('Copyright Date').setResultsName('copyright_date') # Copyright Number copyright_number = basic.alphanum(_config.field_size('work', 'copyright_number')) copyright_number = copyright_number.setName('Copyright Number').setResultsName('copyright_number') # Duration duration = basic.time() duration = duration.setName('Duration').setResultsName('duration') # Recorded Indicator recorded = basic.flag(compulsory=True) recorded = recorded.setName('Recorded Indicator').setResultsName('recorded_indicator') # Contact Name contact_name = basic.alphanum(_config.field_size('work', 'contact_name')) contact_name = contact_name.setName('Contact Name').setResultsName('contact_name') # Contact ID contact_id = basic.alphanum(_config.field_size('work', 'contact_id')) contact_id = contact_id.setName('Contact ID').setResultsName('contact_id') # Grand Rights Indicator
sender_id = sender_id.setName('Sender ID').setResultsName('sender_id') # Sender Name sender_name = basic.alphanum(_config.field_size('transmission_header', 'sender_name'), compulsory=True) sender_name = sender_name.setName('Sender Name').setResultsName('sender_name') # EDI Version edi_version = pp.Literal(_config.field_value('transmission_header', 'edi_version')) edi_version = edi_version.setName('EDI Version').setResultsName('edi_version') # Creation Date creation_date = basic.date(compulsory=True) creation_date = creation_date.setName('Creation Date').setResultsName('creation_date') # Creation Time creation_time = basic.time() creation_time = creation_time.setName('Creation Time').setResultsName('creation_time') # Transmission Date transmission_date = basic.date(compulsory=True) transmission_date = transmission_date.setName('Transmission Date').setResultsName('transmission_date') # Character Set character_set = table.char_code(_config.field_size('transmission_header', 'character_set')) character_set = character_set.setName('Character Set').setResultsName('character_set') """ Rules """ # Creation date and time pattern
# Performing Artist First Name performing_artist_first_name = basic.alphanum(_config.field_size('performing_artist', 'performer_first_name')) performing_artist_first_name = performing_artist_first_name.setName('Performing Artist First Name').setResultsName( 'performing_artist_first_name') """ REC fields. """ # First Release Date first_release = basic.date() first_release = first_release.setName('First Release Date').setResultsName('first_release_date') # First Release Duration first_release_duration = basic.time() first_release_duration = first_release_duration.setName('First Release Duration').setResultsName( 'first_release_duration') # First Album Title first_title = basic.alphanum(_config.field_size('recording_detail', 'first_album_title')) first_title = first_title.setName('First Album Title').setResultsName('first_album_title') # First Album Label first_label = basic.alphanum(_config.field_size('recording_detail', 'first_album_label')) first_label = first_label.setName('First Album Label').setResultsName('first_album_label') # First Release Catalog # first_release_catalog_n = basic.alphanum(_config.field_size('recording_detail', 'first_release_catalog_id')) first_release_catalog_n = first_release_catalog_n.setName('First Release Catalog #').setResultsName( 'first_release_catalog_n')