コード例 #1
0
class TestTransmissionHeaderDecoder(unittest.TestCase):
    def setUp(self):
        self._decoder = TransmissionHeaderDictionaryDecoder()

    def test_encoded(self):
        data = {}

        data['record_type'] = 'HDR'
        data['sender_id'] = 'SND123'
        data['sender_name'] = 'THE SENDER'
        data['sender_type'] = 'SO'
        data['creation_date_time'] = datetime.datetime.strptime(
            '20030216', '%Y%m%d').date()
        data['transmission_date'] = datetime.datetime.strptime(
            '20030217', '%Y%m%d').date()
        data['edi_standard'] = '01.10'
        data['character_set'] = 'ASCII'

        record = self._decoder.decode(data)

        self.assertEqual('HDR', record.record_type)
        self.assertEqual('SND123', record.sender_id)
        self.assertEqual('THE SENDER', record.sender_name)
        self.assertEqual('SO', record.sender_type)
        self.assertEqual(
            datetime.datetime.strptime('20030216', '%Y%m%d').date(),
            record.creation_date_time)
        self.assertEqual(
            datetime.datetime.strptime('20030217', '%Y%m%d').date(),
            record.transmission_date)
        self.assertEqual('01.10', record.edi_standard)
        self.assertEqual('ASCII', record.character_set)
コード例 #2
0
class TestTransmissionHeaderDecoder(unittest.TestCase):
    def setUp(self):
        self._decoder = TransmissionHeaderDictionaryDecoder()

    def test_encoded(self):
        data = {}

        data['record_type'] = 'HDR'
        data['sender_id'] = 'SND123'
        data['sender_name'] = 'THE SENDER'
        data['sender_type'] = 'SO'
        data['creation_date_time'] = datetime.datetime.strptime('20030216',
                                                                '%Y%m%d').date()
        data['transmission_date'] = datetime.datetime.strptime('20030217',
                                                               '%Y%m%d').date()
        data['edi_standard'] = '01.10'
        data['character_set'] = 'ASCII'

        record = self._decoder.decode(data)

        self.assertEqual('HDR', record.record_type)
        self.assertEqual('SND123', record.sender_id)
        self.assertEqual('THE SENDER', record.sender_name)
        self.assertEqual('SO', record.sender_type)
        self.assertEqual(
            datetime.datetime.strptime('20030216', '%Y%m%d').date(),
            record.creation_date_time)
        self.assertEqual(
            datetime.datetime.strptime('20030217', '%Y%m%d').date(),
            record.transmission_date)
        self.assertEqual('01.10', record.edi_standard)
        self.assertEqual('ASCII', record.character_set)
コード例 #3
0
def _default_record_decoders():
    decoders = {}

    decoders['acknowledgement'] = AcknowledgementDictionaryDecoder()
    decoders['message'] = MessageDictionaryDecoder()
    decoders['agreement'] = AgreementDictionaryDecoder()
    decoders['territory_in_agreement'] = AgreementTerritoryDictionaryDecoder()
    decoders['additional_related_information'] = \
        AdditionalRelatedInformationDictionaryDecoder()
    decoders['group_header'] = GroupHeaderDictionaryDecoder()
    decoders['group_trailer'] = GroupTrailerDictionaryDecoder()
    decoders['group_trailer_base'] = GroupTrailerDictionaryDecoder()
    decoders['group_trailer_short'] = GroupTrailerDictionaryDecoder()
    decoders['interested_party_agreement'] = \
        InterestedPartyForAgreementDictionaryDecoder()
    decoders['nra_agreement_party'] = \
        NonRomanAlphabetAgreementPartyDictionaryDecoder()
    decoders['nra_publisher_name'] = \
        NonRomanAlphabetPublisherNameDictionaryDecoder()
    decoders['nra_writer_name'] = NonRomanAlphabetWriterNameDictionaryDecoder()
    decoders['nra_title'] = NonRomanAlphabetTitleDictionaryDecoder()
    decoders['nra_performance_data'] = \
        NonRomanAlphabetPerformanceDataDictionaryDecoder()
    decoders['nra_work'] = NonRomanAlphabetWorkDictionaryDecoder()
    decoders['nra_other_writer'] = \
        NonRomanAlphabetOtherWriterDictionaryDecoder()
    decoders['publisher'] = PublisherRecordDictionaryDecoder()
    decoders['publisher_territory'] = IPTerritoryOfControlDictionaryDecoder()
    decoders['transmission_header'] = TransmissionHeaderDictionaryDecoder()
    decoders['transmission_trailer'] = TransmissionTrailerDictionaryDecoder()
    decoders['work'] = WorkDictionaryDecoder()
    decoders['work_conflict'] = WorkDictionaryDecoder()
    decoders['work_alternate_title'] = AlternateTitleDictionaryDecoder()
    decoders['entire_work_title'] = AuthoredWorkDictionaryDecoder()
    decoders['original_work_title'] = AuthoredWorkDictionaryDecoder()
    decoders['performing_artist'] = PerformingArtistDictionaryDecoder()
    decoders['recording_detail'] = RecordingDetailDictionaryDecoder()
    decoders['work_origin'] = WorkOriginDictionaryDecoder()
    decoders['instrumentation_summary'] = \
        InstrumentationSummaryDictionaryDecoder()
    decoders['instrumentation_detail'] = \
        InstrumentationDetailDictionaryDecoder()
    decoders['component'] = ComponentDictionaryDecoder()
    decoders['writer'] = WriterRecordDictionaryDecoder()
    decoders['writer_publisher'] = PublisherForWriterDictionaryDecoder()
    decoders['writer_territory'] = IPTerritoryOfControlDictionaryDecoder()
    decoders['filename_new'] = FileTagDictionaryDecoder()
    decoders['filename_old'] = FileTagDictionaryDecoder()

    return decoders
コード例 #4
0
 def setUp(self):
     self._decoder = TransmissionHeaderDictionaryDecoder()
コード例 #5
0
 def setUp(self):
     self._decoder = TransmissionHeaderDictionaryDecoder()