Converted property syntax of WKBWriter
This commit is contained in:
parent
393811c67a
commit
d419b0c9bd
|
@ -233,29 +233,29 @@ class WKBWriter(IOBase):
|
|||
byteorder = property(_get_byteorder, _set_byteorder)
|
||||
|
||||
# Property for getting/setting the output dimension.
|
||||
def _get_outdim(self):
|
||||
@property
|
||||
def outdim(self):
|
||||
return wkb_writer_get_outdim(self.ptr)
|
||||
|
||||
def _set_outdim(self, new_dim):
|
||||
@outdim.setter
|
||||
def outdim(self, new_dim):
|
||||
if new_dim not in (2, 3):
|
||||
raise ValueError('WKB output dimension must be 2 or 3')
|
||||
wkb_writer_set_outdim(self.ptr, new_dim)
|
||||
|
||||
outdim = property(_get_outdim, _set_outdim)
|
||||
|
||||
# Property for getting/setting the include srid flag.
|
||||
def _get_include_srid(self):
|
||||
@property
|
||||
def srid(self):
|
||||
return bool(ord(wkb_writer_get_include_srid(self.ptr)))
|
||||
|
||||
def _set_include_srid(self, include):
|
||||
@srid.setter
|
||||
def srid(self, include):
|
||||
if include:
|
||||
flag = b'\x01'
|
||||
else:
|
||||
flag = b'\x00'
|
||||
wkb_writer_set_include_srid(self.ptr, flag)
|
||||
|
||||
srid = property(_get_include_srid, _set_include_srid)
|
||||
|
||||
|
||||
# `ThreadLocalIO` object holds instances of the WKT and WKB reader/writer
|
||||
# objects that are local to the thread. The `GEOSGeometry` internals
|
||||
|
|
|
@ -101,9 +101,8 @@ class GEOSIOTest(SimpleTestCase):
|
|||
|
||||
# Ensuring bad output dimensions are not accepted
|
||||
for bad_outdim in (-1, 0, 1, 4, 423, 'foo', None):
|
||||
# Equivalent of `wkb_w.outdim = bad_outdim`
|
||||
with self.assertRaises(ValueError):
|
||||
wkb_w._set_outdim(bad_outdim)
|
||||
wkb_w.outdim = bad_outdim
|
||||
|
||||
# Now setting the output dimensions to be 3
|
||||
wkb_w.outdim = 3
|
||||
|
|
Loading…
Reference in New Issue