示例#1
0
    def test_google(self):
        sample = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                              'data', 'sample.gpx')

        argv = []
        argv.append('-f')
        argv.append(sample)

        memacs = GPX(argv=argv)
        try:
            data = memacs.test_get_entries()

            # both addresses are reasonable for the given coordinates and
            # OSM seems to return the second one at 2018-08-25 while the
            # first one was true when the original author developed this
            # test:
            self.assertTrue(data[0] in [
                '** <2017-04-01 Sat 10:50> Eggenberger Allee 9, 8020 Graz, Austria	:network:',
                '** <2017-04-01 Sat 10:50> Alte Poststraße 150, 8020 Graz, Austria	:network:'
            ])
            self.assertEqual(data[1], "   :PROPERTIES:")
            self.assertEqual(data[2], "   :LATITUDE:   47.0693")
            self.assertEqual(data[3], "   :LONGITUDE:  15.4076001")
            self.assertEqual(
                data[4],
                "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
            self.assertEqual(data[5], "   :END:")
        except RuntimeError as e:
            print('skipped test_google because of {}'.format(e))
示例#2
0
文件: gpx_test.py 项目: novoid/Memacs
    def test_osm(self):
        sample = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'sample.gpx'
        )

        argv = []
        argv.append('-f')
        argv.append(sample)
        argv.append('-p osm')

        memacs = GPX(argv=argv)
        data = memacs.test_get_entries()

        # both addresses are reasonable for the given coordinates and
        # OSM seems to return the second one at 2018-08-25 while the
        # first one was true when the original author developed this
        # test:
        self.assertTrue(
            data[0] in ['** <2017-04-01 Sat 10:50> FH Joanneum - Prüffeld, 150, Alte Poststraße, Gries, Graz, Steiermark, 8020, Österreich	:network:',
                        '** <2017-04-01 Sat 10:50> FH Joanneum, 13, Eggenberger Allee, Eggenberg, Graz, Steiermark, 8020, Österreich	:network:'])
        self.assertEqual(
            data[1],
            "   :PROPERTIES:")
        self.assertEqual(
            data[2],
            "   :LATITUDE:   47.0693")
        self.assertEqual(
            data[3],
            "   :LONGITUDE:  15.4076001")
        self.assertEqual(
            data[4],
            "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
        self.assertEqual(
            data[5],
            "   :END:")
示例#3
0
    def test_osm(self):
        sample = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                              'data', 'sample.gpx')

        argv = []
        argv.append('-f')
        argv.append(sample)
        argv.append('-p osm')

        memacs = GPX(argv=argv)
        data = memacs.test_get_entries()

        # both addresses are reasonable for the given coordinates and
        # OSM seems to return the second one at 2018-08-25 while the
        # first one was true when the original author developed this
        # test:
        self.assertTrue(data[0] in [
            '** <2017-04-01 Sat 10:50> FH Joanneum - Prüffeld, 150, Alte Poststraße, Gries, Graz, Steiermark, 8020, Österreich	:network:',
            '** <2017-04-01 Sat 10:50> FH Joanneum, 13, Eggenberger Allee, Eggenberg, Graz, Steiermark, 8020, Österreich	:network:'
        ])
        self.assertEqual(data[1], "   :PROPERTIES:")
        self.assertEqual(data[2], "   :LATITUDE:   47.0693")
        self.assertEqual(data[3], "   :LONGITUDE:  15.4076001")
        self.assertEqual(
            data[4],
            "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
        self.assertEqual(data[5], "   :END:")
示例#4
0
    def test_osm(self):
        sample = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'sample.gpx'
        )

        argv = []
        argv.append('-f')
        argv.append(sample)
        argv.append('-p osm')
        
        memacs = GPX(argv=argv)
        data = memacs.test_get_entries()

        self.assertEqual(
            data[0],
            u"** <2017-04-01 Sat 10:50> FH Joanneum - Prüffeld, 150, Alte Poststraße, Gries, Graz, Steiermark, 8020, Österreich	:network:")
        self.assertEqual(
            data[1],
            "   :PROPERTIES:")
        self.assertEqual(
            data[2],
            "   :LATITUDE:   47.0693")
        self.assertEqual(
            data[3],
            "   :LONGITUDE:  15.4076001")
        self.assertEqual(
            data[4],
            "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
        self.assertEqual(
            data[5],
            "   :END:")
示例#5
0
    def test_google(self):
        sample = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'sample.gpx'
        )

        argv = []
        argv.append('-f')
        argv.append(sample)
        
        memacs = GPX(argv=argv)
        data = memacs.test_get_entries()

        self.assertEqual(
            data[0],
            u"** <2017-04-01 Sat 10:50> Eggenberger Allee 9, 8020 Graz, Austria	:network:")
        self.assertEqual(
            data[1],
            "   :PROPERTIES:")
        self.assertEqual(
            data[2],
            "   :LATITUDE:   47.0693")
        self.assertEqual(
            data[3],
            "   :LONGITUDE:  15.4076001")
        self.assertEqual(
            data[4],
            "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
        self.assertEqual(
            data[5],
            "   :END:")
示例#6
0
def main():
    global memacs
    memacs = GPX(prog_version=PROG_VERSION_NUMBER,
                 prog_version_date=PROG_VERSION_DATE,
                 prog_short_description=PROG_SHORT_DESCRIPTION,
                 prog_tag=PROG_TAG,
                 copyright_year=COPYRIGHT_YEAR,
                 copyright_authors=COPYRIGHT_AUTHORS)
    memacs.handle_main()
示例#7
0
文件: gpx_test.py 项目: novoid/Memacs
    def test_google(self):
        sample = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'data', 'sample.gpx'
        )

        argv = []
        argv.append('-f')
        argv.append(sample)

        memacs = GPX(argv=argv)
        try:
            data = memacs.test_get_entries()

            # both addresses are reasonable for the given coordinates and
            # OSM seems to return the second one at 2018-08-25 while the
            # first one was true when the original author developed this
            # test:
            self.assertTrue(
                data[0] in ['** <2017-04-01 Sat 10:50> Eggenberger Allee 9, 8020 Graz, Austria	:network:',
                            '** <2017-04-01 Sat 10:50> Alte Poststraße 150, 8020 Graz, Austria	:network:'])
            self.assertEqual(
                data[1],
                "   :PROPERTIES:")
            self.assertEqual(
                data[2],
                "   :LATITUDE:   47.0693")
            self.assertEqual(
                data[3],
                "   :LONGITUDE:  15.4076001")
            self.assertEqual(
                data[4],
                "   :ID:         c2dc4f2289d79cff4cf27faa95863f8cb5b8cb21")
            self.assertEqual(
                data[5],
                "   :END:")
        except RuntimeError as e:
            print('skipped test_google because of {}'.format(e))
示例#8
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from memacs.gpx import GPX

PROG_VERSION_NUMBER = "0.1"
PROG_VERSION_DATE = "2017-03-02"
PROG_SHORT_DESCRIPTION = "Memacs for GPX files"
PROG_TAG = "gps"

COPYRIGHT_YEAR = "2017"
COPYRIGHT_AUTHORS = """Manuel Koell <*****@*****.**>"""


if __name__ == "__main__":
    memacs = GPX(prog_version=PROG_VERSION_NUMBER,
                 prog_version_date=PROG_VERSION_DATE,
                 prog_short_description=PROG_SHORT_DESCRIPTION,
                 prog_tag=PROG_TAG,
                 copyright_year=COPYRIGHT_YEAR,
                 copyright_authors=COPYRIGHT_AUTHORS)
    memacs.handle_main()