Skip to content

Commit

Permalink
add test for issue #656
Browse files Browse the repository at this point in the history
  • Loading branch information
jswhit committed May 8, 2017
1 parent 98e19ab commit 8c030a1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/tst_Unsigned.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import unittest
import netCDF4
from numpy.testing import assert_array_equal
import numpy as np

CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))

class Test_Unsigned(unittest.TestCase):
def test_unsigned(self):
fpath = os.path.join(CURRENT_DIR, "ubyte.nc3")
f = netCDF4.Dataset(fpath)
data = f['ub'][:]
assert data.dtype.str[1:] == 'u1'
assert_array_equal(data,np.array([0,255],np.uint8))

if __name__ == '__main__':
unittest.main()

0 comments on commit 8c030a1

Please sign in to comment.