コード例 #1
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_relation_with_tags(self):
     self._run_file(
         create_osm_file([
             osmobj('R',
                    id=1,
                    members=[('way', 1, '')],
                    tags=dict(foo='bar', name='xx'))
         ]))
コード例 #2
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_way_with_tags(self):
     self._run_file(
         create_osm_file([
             osmobj('W',
                    id=1,
                    nodes=[1, 2, 3],
                    tags=dict(foo='bar', name='xx'))
         ]))
コード例 #3
0
ファイル: test_io.py プロジェクト: andrewljohnson/pyosmium
 def test_file_header(self):
     fn = create_osm_file([osmobj('N', id=1)])
     try:
         rd = o.io.Reader(fn)
         h = rd.header()
         assert_false(h.has_multiple_object_versions)
         rd.close()
     finally:
         os.remove(fn)
コード例 #4
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_broken_timestamp(self):
     fn = create_osm_file([osmobj('N', id=1, timestamp='x')])
     try:
         rd = o.io.Reader(fn)
         with assert_raises(ValueError):
             o.apply(rd, o.SimpleHandler())
             rd.close()
     finally:
         os.remove(fn)
コード例 #5
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_file_header(self):
     fn = create_osm_file([osmobj('N', id=1)])
     try:
         rd = o.io.Reader(fn)
         h = rd.header()
         assert_false(h.has_multiple_object_versions)
         rd.close()
     finally:
         os.remove(fn)
コード例 #6
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_broken_timestamp(self):
     fn = create_osm_file([osmobj('N', id=1, timestamp='x')])
     try:
         rd = o.io.Reader(fn)
         with assert_raises(ValueError):
             o.apply(rd, o.SimpleHandler())
             rd.close()
     finally:
         os.remove(fn)
コード例 #7
0
ファイル: test_threaded.py プロジェクト: osmcode/pyosmium
def import_data(function_complete):
    data = [osmobj('N', id=1, lat=28.0, lon=-23.3)]
    fn = create_osm_file(data)

    c = CountingHandler()
    try:
        c.apply_file(fn)
    finally:
        os.remove(fn)

    function_complete.set()
コード例 #8
0
def import_data(function_complete):
    data = [osmobj('N', id=1, lat=28.0, lon=-23.3)]
    fn = create_osm_file(data)

    c = CountingHandler()
    try:
        c.apply_file(fn)
    finally:
        os.remove(fn)

    function_complete.set()
コード例 #9
0
 def test_file_header(self):
     fn = create_osm_file([osmobj('N', id=1)])
     try:
         rd = o.io.Reader(fn)
         h = rd.header()
         assert_false(h.has_multiple_object_versions)
         assert_true(h.box().valid())
         assert_equals(h.box().size(), 64800.0)
         rd.close()
     finally:
         os.remove(fn)
コード例 #10
0
ファイル: test_replication.py プロジェクト: osmcode/pyosmium
def test_get_newest_change_from_file():
    data = [osmobj('N', id=1, version=1, changeset=63965061, uid=8369524,
                   timestamp='2018-10-29T03:56:07Z', user='******')]
    fn = create_osm_file(data)


    try:
        val = osmium.replication.newest_change_from_file(fn)
        assert_equals(val, mkdate(2018, 10, 29, 3, 56, 7))
    finally:
        os.remove(fn)
コード例 #11
0
ファイル: test_replication.py プロジェクト: osmcode/pyosmium
def test_get_replication_header_empty():
    data = [osmobj('N', id=1, version=1, changeset=63965061, uid=8369524,
                   timestamp='2018-10-29T03:56:07Z', user='******')]
    fn = create_osm_file(data)

    try:
        val = rutil.get_replication_header(fn)
        assert_is_none(val.url)
        assert_is_none(val.sequence)
        assert_is_none(val.timestamp)
    finally:
        os.remove(fn)
コード例 #12
0
def test_get_newest_change_from_file():
    data = [
        osmobj('N',
               id=1,
               version=1,
               changeset=63965061,
               uid=8369524,
               timestamp='2018-10-29T03:56:07Z',
               user='******')
    ]
    fn = create_osm_file(data)

    try:
        val = osmium.replication.newest_change_from_file(fn)
        assert_equals(val, mkdate(2018, 10, 29, 3, 56, 7))
    finally:
        os.remove(fn)
コード例 #13
0
def test_get_replication_header_empty():
    data = [
        osmobj('N',
               id=1,
               version=1,
               changeset=63965061,
               uid=8369524,
               timestamp='2018-10-29T03:56:07Z',
               user='******')
    ]
    fn = create_osm_file(data)

    try:
        val = rutil.get_replication_header(fn)
        assert_is_none(val.url)
        assert_is_none(val.sequence)
        assert_is_none(val.timestamp)
    finally:
        os.remove(fn)
コード例 #14
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_relation_with_tags(self):
     self._run_file(create_osm_file([osmobj('R', id=1, members=[('way', 1, '')],
                                            tags=dict(foo='bar', name='xx'))]))
コード例 #15
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_node_only(self):
     self._run_file(create_osm_file([osmobj('N', id=1)]))
コード例 #16
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_node_with_tags(self):
     self._run_file(
         create_osm_file(
             [osmobj('N', id=1, tags=dict(foo='bar', name='xx'))]))
コード例 #17
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_relation_only(self):
     self._run_file(
         create_osm_file([osmobj('R', id=1, members=[('way', 1, '')])]))
コード例 #18
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_way_only(self):
     self._run_file(create_osm_file([osmobj('W', id=1, nodes=[1, 2, 3])]))
コード例 #19
0
ファイル: test_io.py プロジェクト: saerdnaer/pyosmium
 def test_node_only(self):
     self._run_file(create_osm_file([osmobj('N', id=1)]))
コード例 #20
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_way_only(self):
     self._run_file(create_osm_file([osmobj('W', id=1, nodes=[1,2,3])]))
コード例 #21
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_way_with_tags(self):
     self._run_file(create_osm_file([osmobj('W', id=1, nodes=[1,2,3],
                                            tags=dict(foo='bar', name='xx'))]))
コード例 #22
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_node_with_tags(self):
     self._run_file(create_osm_file([osmobj('N', id=1, 
                                            tags=dict(foo='bar', name='xx'))]))
コード例 #23
0
ファイル: test_io.py プロジェクト: osmcode/pyosmium
 def test_relation_only(self):
     self._run_file(create_osm_file([osmobj('R', id=1, members=[('way', 1, '')])]))