def test_construct_local_file_dict(self): t = XArray('{}/user/xpatterns/files/test-array-dict'.format(hdfs_prefix)) self.assertEqualLen(4, t) self.assertIs(dict, t.dtype()) self.assertDictEqual({1: 'a', 2: 'b'}, t[0])
def test_construct_local_file_list(self): t = XArray('{}/user/xpatterns/files/test-array-list'.format(hdfs_prefix)) self.assertEqualLen(4, t) self.assertIs(list, t.dtype()) self.assertListEqual([1, 2], t[0])
def test_construct_local_file_float(self): t = XArray('{}/user/xpatterns/files/test-array-float'.format(hdfs_prefix)) self.assertEqualLen(4, t) self.assertIs(float, t.dtype()) self.assertEqual(1.0, t[0])
def test_construct_local_file_str(self): t = XArray('{}/user/xpatterns/files/test-array-str'.format(hdfs_prefix)) self.assertEqualLen(4, t) self.assertIs(str, t.dtype()) self.assertEqual('a', t[0])
def test_construct_file_int(self): path = '{}/user/xpatterns/files/test-array-int'.format(hdfs_prefix) t = XArray(path) self.assertEqualLen(4, t) self.assertIs(int, t.dtype()) self.assertEqual(1, t[0])