コード例 #1
0
ファイル: test_exporter.py プロジェクト: nce/sedater
class TestXMLExporter(unittest.TestCase):
    def setUp(self):
        self.tmp = TempDirectory()
        self.dir = self.tmp.makedir('foobar/')
        self.exp = XMLExporter(self.dir)
    def tearDown(self):
        TempDirectory.cleanup_all()

    #not responsible for creation
    def DISABLEDtest_creation_of_meta_info_file(self):
        filename = 'barfoo.xml'
        status = self.exp._exportMetaInformationToXML('', '', filename)
        self.assertTrue(os.path.isfile(self.dir+'metainformation.xml'))
        self.assertTrue(status)
    #not responsible for creation;
    # TODO: fix
    def DISABLEDtest_content_of_meta_info_file(self):
        filename = 'barfoo.xml'
        status = self.exp._exportMetaInformationToXML('01', '02', filename)
        tree = et.parse(self.dir + 'metainformation.xml')
        xml = tree.getroot()
        session = xml.find('Session')
        exercise = xml.find('Exercise')
        annotation = xml.find('Annotationfile')
        self.assertEquals('01', session.text)
        self.assertEquals('02', exercise.text)
        self.assertEquals(self.dir + filename, annotation.text)
    def DISABLEDtest_content_of_xml_export_file(self):
        src = lib.Sourcefile._make(['', '', '', '', lib.Orientation.left])
        input = lib.Validationfile._make([src, 'Gold', [['Foo', 'Bar']], 
            [{ 'Fu': '1', 'Baz': '2'}, {'Fu': '3', 'Baz': '4'}]])
        self.assertTrue(self.exp.export(input))
        tree = et.parse(self.dir + 'annotation.xml')
        xml = tree.getroot()
        validation = xml.find('Validation')
        self.assertEquals(validation.attrib, {'Type': 'Gold'})
        sensor = validation.find('Sensor')
        self.assertEquals(sensor.attrib, {'Orientation': 'left'})
        meta = sensor.find('Meta')
        self.assertEquals(meta[0].tag, 'Foo')
        self.assertEquals(meta[0].text, 'Bar')
        content = sensor.find('Content')
        self.assertEquals(content[0].tag,     'No1')
        self.assertEquals(content[0][0].tag,  'Fu')
        self.assertEquals(content[0][0].text, '1')
        self.assertEquals(content[0][1].tag,  'Baz')
        self.assertEquals(content[0][1].text, '2')
        self.assertEquals(content[1][0].tag,  'Fu')
        self.assertEquals(content[1][0].text, '3')
        self.assertEquals(content[1][1].tag,  'Baz')
        self.assertEquals(content[1][1].text, '4')
コード例 #2
0
ファイル: main.py プロジェクト: nce/sedater
        rightRawValidationSegments = raw.initSensors[Orientation.right.name]\
                .normalizedSensorSegments
        currentSession = raw.sessionIdentifier
        currentExercise = raw.exerciseIdentifier


        # Raw Data Export
        rawValidation = CSVExporter()
        location = rawValidation.prepareOutputDir(
                        outputDir
                        , currentSession
                        , currentExercise)
        rawValidation.export(
                leftRawValidationSegments
                , location + 'leftSensorNormalized.csv'
                , cli.args.csv_headers)
        rawValidation.export(
                rightRawValidationSegments
                , location + 'rightSensorNormalized.csv'
                , cli.args.csv_headers)

    # Text Data Conversion
    txt = TxtConverter(importer.pairedFiles)
    txt.processTxtFiles()

    # Txt Data Export
    txtValidation = XMLExporter(outputDir)
    for validationFile in txt.validationData:
        txtValidation.export(validationFile)

コード例 #3
0
ファイル: test_exporter.py プロジェクト: nce/sedater
 def setUp(self):
     self.tmp = TempDirectory()
     self.dir = self.tmp.makedir('foobar/')
     self.exp = XMLExporter(self.dir)