From 4a4d194430667be5de80c1ad62a34897900395d7 Mon Sep 17 00:00:00 2001
From: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
Date: Mon, 8 Jan 2018 16:20:43 -0600
Subject: [PATCH] replaced hand-coded list of lists Python object inputs to
numpy.record.array in test files test_tables.py and test_tablesMD.py to
address failures with NumPy 1.14. See
https://github.com/numpy/numpy/issues/10344
---
tables/tests/test_indexes.py | 2 +-
tables/tests/test_tables.py | 410 +++++++++++++++++++++---------------------
tables/tests/test_tablesMD.py | 244 ++++++++++++-------------
3 files changed, 328 insertions(+), 328 deletions(-)
diff --git a/tables/tests/test_indexes.py b/tables/tests/test_indexes.py
index 256d699d..548f75a2 100644
--- a/tables/tests/test_indexes.py
+++ b/tables/tests/test_indexes.py
@@ -1226,7 +1226,7 @@ def test07_noauto(self):
unsavedindexedrows = table._unsaved_indexedrows
# Now, modify just one row:
- table.modify_rows(3, None, 1, [["asa", 0, 3, 3.1]])
+ table.modify_rows(3, None, 1, [("asa", 0, 3, 3.1)])
if self.reopen:
self._reopen(mode='a')
table = self.h5file.root.table
diff --git a/tables/tests/test_tables.py b/tables/tests/test_tables.py
index 0ff6fb79..82051bfc 100644
--- a/tables/tests/test_tables.py
+++ b/tables/tests/test_tables.py
@@ -2903,16 +2903,16 @@ def test01(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing row
table[2] = (456, 'db2', 1.2)
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [456, b'db2', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (456, b'db2', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -2935,16 +2935,16 @@ def test01b(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing row
table[2] = (456, 'db2', 1.2)
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [456, b'db2', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (456, b'db2', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -2967,17 +2967,17 @@ def test02(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, b'db1', 1.2]], formats="i4,a3,f8")
+ rows = records.array([(457, b'db1', 1.2)], formats="i4,a3,f8")
table[1:3:2] = rows
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3000,19 +3000,19 @@ def test03(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, b'db1', 1.2], [5, b'de1', 1.3]],
+ rows = records.array([(457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8")
# table.modify_rows(start=1, rows=rows)
table[1:3] = rows
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [5, b'de1', 1.3], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (5, b'de1', 1.3), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3035,19 +3035,19 @@ def test04(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, b'db1', 1.2], [6, b'de2', 1.3]],
+ rows = records.array([(457, b'db1', 1.2), (6, b'de2', 1.3)],
formats="i4,a3,f8")
# table[1:4:2] = rows
table[1::2] = rows
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [457, b'db1', 1.2], [6, b'de2', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (457, b'db1', 1.2), (6, b'de2', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3070,16 +3070,16 @@ def test05(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3]],
+ r = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3)],
formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1] = -1
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [-1, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (-1, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3102,16 +3102,16 @@ def test06a(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4] = [2, 3, 4]
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3134,10 +3134,10 @@ def test06b(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
with self.assertRaises(NotImplementedError):
@@ -3172,15 +3172,15 @@ def test07(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 1, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 1, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4:2] = [2, 3]
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [3, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (3, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3203,16 +3203,16 @@ def test08(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4:3] = [2]
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3235,19 +3235,19 @@ def test09(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Try to modify beyond the extend
# This will silently exclude the non-fitting rows
- rows = records.array([[457, b'db1', 1.2], [6, b'de2', 1.3]],
+ rows = records.array([(457, b'db1', 1.2), (6, b'de2', 1.3)],
formats="i4,a3,f8")
table[1::2] = rows
# How it should look like
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [457, b'db1', 1.2], [6, b'de2', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (457, b'db1', 1.2), (6, b'de2', 1.3)],
formats="i4,a3,f8")
# Read the modified table
@@ -3292,18 +3292,18 @@ def test01(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing row
for row in table.iterrows(2, 3):
- (row['col1'], row['col2'], row['col3']) = [456, 'db2', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (456, 'db2', 1.2)
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [456, b'db2', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (456, b'db2', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3326,21 +3326,21 @@ def test02(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, 3, 2):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 3:
- (row['col1'], row['col2'], row['col3']) = [6, 'de2', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (6, 'de2', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3363,21 +3363,21 @@ def test03(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, 3):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 2:
- (row['col1'], row['col2'], row['col3']) = [5, 'de1', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (5, 'de1', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [5, b'de1', 1.3], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (5, b'de1', 1.3), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3400,21 +3400,21 @@ def test04(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, stop=4, step=2):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 3:
- (row['col1'], row['col2'], row['col3']) = [6, 'de2', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (6, 'de2', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [457, b'db1', 1.2], [6, b'de2', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (457, b'db1', 1.2), (6, b'de2', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3437,18 +3437,18 @@ def test05(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3]],
+ r = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3)],
formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
for row in table.iterrows(1, 2):
row['col1'] = -1
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [-1, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (-1, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3471,18 +3471,18 @@ def test06(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
for row in table.iterrows(1, 4):
row['col1'] = row.nrow + 1
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3505,18 +3505,18 @@ def test07(self):
table.nrowsinbuf = self.buffersize # set buffer value
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 1, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 1, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just rows with col1 < 456
for row in table.where('col1 < 456'):
row['col1'] = 2
row['col2'] = 'ada'
row.update()
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ada', 1.3],
- [457, b'db1', 1.2], [2, b'ada', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ada', 1.3),
+ (457, b'db1', 1.2), (2, b'ada', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3748,8 +3748,8 @@ def test00(self):
print("Running %s.test00..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
self.h5file.create_table(self.h5file.root, 'recarray', r)
@@ -3768,8 +3768,8 @@ def test01(self):
print("Running %s.test01..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Get an offsetted bytearray
r1 = r[1:]
@@ -3849,13 +3849,13 @@ class Rec(tables.IsDescription):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Create the complete table
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the original table
@@ -3880,17 +3880,17 @@ def test05(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
self._reopen()
table = self.h5file.root.recarray
# Create the complete table
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
@@ -3923,8 +3923,8 @@ def test06a(self):
# Modify just one existing rows
table.modify_rows(start=1, rows=[(456, 'db1', 1.2)])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [456, b'db1', 1.2],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (456, b'db1', 1.2),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
@@ -3950,16 +3950,16 @@ def test06b(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing rows
- table.modify_rows(start=2, rows=records.array([[456, 'db2', 1.2]],
+ table.modify_rows(start=2, rows=records.array([(456, 'db2', 1.2)],
formats="i4,a3,f8"))
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [456, b'db2', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (456, b'db2', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -3984,15 +3984,15 @@ def test07a(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
table.modify_rows(start=1, rows=[(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [5, b'de1', 1.3], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (5, b'de1', 1.3), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4017,17 +4017,17 @@ def test07b(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, b'db1', 1.2], [5, b'de1', 1.3]],
+ rows = records.array([(457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8")
table.modify_rows(start=1, rows=rows)
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [457, b'db1', 1.2],
- [5, b'de1', 1.3], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (457, b'db1', 1.2),
+ (5, b'de1', 1.3), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4052,12 +4052,12 @@ def test07c(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, b'db1', 1.2], [5, b'de1', 1.3]],
+ rows = records.array([(457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8")
self.assertRaises(ValueError, table.modify_rows,
start=1, stop=2, rows=rows)
@@ -4073,16 +4073,16 @@ def test08a(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.modify_columns(start=1, columns=[[2, 3, 4]], names=["col1"])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4108,16 +4108,16 @@ def test08a2(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
table.modify_column(start=1, column=[2, 3, 4], colname="col1")
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4142,17 +4142,17 @@ def test08b(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
columns = records.fromarrays(np.array([[2, 3, 4]]), formats="i4")
table.modify_columns(start=1, columns=columns, names=["col1"])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4178,17 +4178,17 @@ def test08b2(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
columns = records.fromarrays(np.array([[2, 3, 4]]), formats="i4")
table.modify_column(start=1, column=columns, colname="col1")
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'ded', 1.3],
- [3, b'db1', 1.2], [4, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'ded', 1.3),
+ (3, b'db1', 1.2), (4, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4214,18 +4214,18 @@ def test08c(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify just one existing column
# columns = records.fromarrays(np.array([[4]]), formats="i4")
# table.modify_columns(start=1, columns=columns, names=["col1"])
table.modify_columns(start=1, columns=[[4]], names=["col1"])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [4, b'ded', 1.3],
- [457, b'db1', 1.2], [5, b'de1', 1.3]],
+ r1 = records.array([(456, b'dbe', 1.2), (4, b'ded', 1.3),
+ (457, b'db1', 1.2), (5, b'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4250,17 +4250,17 @@ def test09a(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify a couple of columns
columns = [["aaa", "bbb", "ccc"], [1.2, .1, .3]]
table.modify_columns(start=1, columns=columns, names=["col2", "col3"])
# Create the modified recarray
- r1 = records.array([[456, b'dbe', 1.2], [2, b'aaa', 1.2],
- [457, b'bbb', .1], [5, b'ccc', .3]],
+ r1 = records.array([(456, b'dbe', 1.2), (2, b'aaa', 1.2),
+ (457, b'bbb', .1), (5, b'ccc', .3)],
formats="i4,a3,f8",
names="col1,col2,col3")
@@ -4286,18 +4286,18 @@ def test09b(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify a couple of columns
- columns = records.array([["aaa", 1.2], ["bbb", .1], ["ccc", .3]],
+ columns = records.array([("aaa", 1.2), ("bbb", .1), ("ccc", .3)],
formats="a3,f8")
table.modify_columns(start=1, columns=columns, names=["col2", "col3"])
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'aaa', 1.2],
- [457, 'bbb', .1], [5, 'ccc', .3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'aaa', 1.2),
+ (457, 'bbb', .1), (5, 'ccc', .3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4322,18 +4322,18 @@ def test09c(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify a couple of columns
- columns = records.array([["aaa", 1.2], ["bbb", .1]],
+ columns = records.array([("aaa", 1.2), ("bbb", .1)],
formats="a3,f8")
table.modify_columns(start=1, step=2, columns=columns,
names=["col2", "col3"])
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'aaa', 1.2],
- [457, 'db1', 1.2], [5, 'bbb', .1]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'aaa', 1.2),
+ (457, 'db1', 1.2), (5, 'bbb', .1)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4358,19 +4358,19 @@ def test09d(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
# Modify a couple of columns
- columns = records.array([["aaa", 1.3], ["bbb", .1]],
+ columns = records.array([("aaa", 1.3), ("bbb", .1)],
formats="a3,f8")
table.modify_columns(start=0, step=2, columns=columns,
names=["col2", "col3"])
# Create the modified recarray
- r1 = records.array([[456, 'aaa', 1.3], [2, 'ded', 1.3],
- [457, 'bbb', .1], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'aaa', 1.3), (2, 'ded', 1.3),
+ (457, 'bbb', .1), (5, 'de1', 1.3)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4396,10 +4396,10 @@ def test10a(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
columns = table.read_coordinates([0, 3])
@@ -4411,8 +4411,8 @@ def test10a(self):
table.modify_coordinates([0, 3], columns)
# Create the modified recarray
- r1 = records.array([[55, b'dbe', 1.9], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [56, b'de1', 1.8]],
+ r1 = records.array([(55, b'dbe', 1.9), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (56, b'de1', 1.8)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4437,10 +4437,10 @@ def test10b(self):
table = self.h5file.create_table(self.h5file.root, 'recarray', Rec)
# append new rows
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'ded', 1.3]], formats="i4,a3,f8")
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'ded', 1.3)], formats="i4,a3,f8")
table.append(r)
- table.append([[457, b'db1', 1.2], [5, b'de1', 1.3]])
+ table.append([(457, b'db1', 1.2), (5, b'de1', 1.3)])
columns = table[[0, 3]]
@@ -4452,8 +4452,8 @@ def test10b(self):
table[[0, 3]] = columns
# Create the modified recarray
- r1 = records.array([[55, b'dbe', 1.9], [2, b'ded', 1.3],
- [457, b'db1', 1.2], [56, b'de1', 1.8]],
+ r1 = records.array([(55, b'dbe', 1.9), (2, b'ded', 1.3),
+ (457, b'db1', 1.2), (56, b'de1', 1.8)],
formats="i4,a3,f8",
names="col1,col2,col3")
# Read the modified table
@@ -4503,8 +4503,8 @@ def test01_copy(self):
print("Running %s.test01_copy..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
table1 = self.h5file.create_table(self.h5file.root, 'table1', r,
"title table1")
@@ -4570,8 +4570,8 @@ def test02_copy(self):
print("Running %s.test02_copy..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
table1 = self.h5file.create_table(self.h5file.root, 'table1', r,
"title table1")
@@ -4696,8 +4696,8 @@ def test04_copy(self):
print("Running %s.test04_copy..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
table1 = self.h5file.create_table(self.h5file.root, 'table1', r,
"title table1")
@@ -4757,8 +4757,8 @@ def test05_copy(self):
print("Running %s.test05_copy..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
table1 = self.h5file.create_table(self.h5file.root, 'table1', r,
"title table1")
@@ -4824,8 +4824,8 @@ def test05b_copy(self):
print("Running %s.test05b_copy..." % self.__class__.__name__)
# Create a recarray
- r = records.array([[456, b'dbe', 1.2], [
- 2, b'de', 1.3]], names='col1,col2,col3')
+ r = records.array([(456, b'dbe', 1.2), (
+ 2, b'de', 1.3)], names='col1,col2,col3')
# Save it in a table:
table1 = self.h5file.create_table(self.h5file.root, 'table1', r,
"title table1")
@@ -5096,7 +5096,7 @@ def test00(self):
"""Checking saving a Table with a moderately large rowsize"""
# Create a recarray
- r = records.array([[np.arange(100)]*2])
+ r = records.array([(np.arange(100))*2])
# Save it in a table:
self.h5file.create_table(self.h5file.root, 'largerow', r)
@@ -5177,7 +5177,7 @@ def test00(self):
values.append(1.-0.j)
formats.append('c32')
- r = records.array([values]*nrows, formats=','.join(formats))
+ r = records.array([tuple(values)]*nrows, formats=','.join(formats))
# Assign the value exceptions
r["f1"][3] = 2
@@ -5251,7 +5251,7 @@ def test01(self):
values.append(1.-0.j)
formats.append('c32')
- r = records.array([values]*nrows, formats=','.join(formats))
+ r = records.array([tuple(values)]*nrows, formats=','.join(formats))
# Assign the value exceptions
r["f1"][3] = 2
diff --git a/tables/tests/test_tablesMD.py b/tables/tests/test_tablesMD.py
index ec40d587..2944b5d5 100644
--- a/tables/tests/test_tablesMD.py
+++ b/tables/tests/test_tablesMD.py
@@ -92,7 +92,7 @@ def initRecArray(self):
row = record[0]
buflist = []
# Fill the recarray
- for i in range(self.expectedrows + 1):
+ for i in range(self.expectedrows):
tmplist = []
# Both forms (list or chararray) works
var0 = ['%04d' % (self.expectedrows - i)] * 2
@@ -117,7 +117,7 @@ def initRecArray(self):
tmplist.append(((var3 >> 8) & 0xff) + ((var3 << 8) & 0xff00))
var7 = var1[0][0][-1]
tmplist.append(var7)
- buflist.append(tmplist)
+ buflist.append(tuple(tmplist))
self.record = np.rec.array(buflist, dtype=record.dtype,
shape=self.expectedrows)
@@ -1007,8 +1007,8 @@ def test00(self):
arrlist2 = [['de']*2]*3
floatlist1 = [[1.2, 2.3]*3]*4
floatlist2 = np.array([[4.5, 2.4]*3]*4)
- b = [[intlist1, arrlist1, floatlist1], [
- intlist2, arrlist2, floatlist2]]
+ b = [(intlist1, arrlist1, floatlist1), (
+ intlist2, arrlist2, floatlist2)]
r = np.rec.array(b, formats='(2,6)i4,(3,2)a3,(4,6)f8',
names='col1,col2,col3')
@@ -1030,8 +1030,8 @@ def test01(self):
arrlist2 = [['de']*2]*3
floatlist1 = [[1.2, 2.3]*3]*4
floatlist2 = np.array([[4.5, 2.4]*3]*4)
- b = [[intlist1, arrlist1, floatlist1], [
- intlist2, arrlist2, floatlist2]]
+ b = [(intlist1, arrlist1, floatlist1), (
+ intlist2, arrlist2, floatlist2)]
r = np.rec.array(b, formats='(2,6)i4,(3,2)a3,(4,6)f8',
names='col1,col2,col3')
@@ -1056,8 +1056,8 @@ def test02(self):
arrlist2 = [['de']*2]*3
floatlist1 = [[1.2, 2.3]*3]*4
floatlist2 = np.array([[4.5, 2.4]*3]*4)
- b = [[intlist1, arrlist1, floatlist1], [
- intlist2, arrlist2, floatlist2]]
+ b = [(intlist1, arrlist1, floatlist1), (
+ intlist2, arrlist2, floatlist2)]
r = np.rec.array(b * 300, formats='(1,6,18)i4,(3,2)a3,(4,6)f8',
names='col1,col2,col3')
@@ -1082,10 +1082,10 @@ def test03(self):
arrlist2 = [['de']*2]*3
floatlist1 = [[1.2, 2.3]*3]*4
floatlist2 = np.array([[4.5, 2.4]*3]*4)
- b = [[intlist1, arrlist1, floatlist1], [
- intlist2, arrlist2, floatlist2]]
+ b = [(intlist1, arrlist1, floatlist1), (
+ intlist2, arrlist2, floatlist2)]
r = np.rec.array(b * 300, formats='(1,6,18)i4,(3,2)a3,(4,6)f8',
- names='col1,col2,col3', shape=300)
+ names='col1,col2,col3', shape=600)
# Get an strided recarray
r2 = r[::2]
@@ -1114,17 +1114,17 @@ def test08a(self):
# Append new rows
s0, s1, s2, s3 = ['dbe']*3, ['ded']*3, ['db1']*3, ['de1']*3
f0, f1, f2, f3 = [[1.2]*2]*3, [[1.3]*2]*3, [[1.4]*2]*3, [[1.5]*2]*3
- r = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1]],
+ r = records.array([([456, 457], s0, f0), ([2, 3], s1, f1)],
formats="(2,)i4,(3,)a3,(3,2)f8")
table.append(r)
- table.append([[[457, 458], s2, f2], [[5, 6], s3, f3]])
+ table.append([([457, 458], s2, f2), ([5, 6], s3, f3)])
# Modify just one existing column
table.cols.col1[1:] = [[[2, 3], [3, 4], [4, 5]]]
# Create the modified recarray
- r1 = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1],
- [[3, 4], s2, f2], [[4, 5], s3, f3]],
+ r1 = records.array([ ([456, 457], s0, f0), ([2, 3], s1, f1),
+ ([3, 4], s2, f2), ([4, 5], s3, f3)],
formats="(2,)i4,(3,)a3,(3,2)f8",
names="col1,col2,col3")
@@ -1149,10 +1149,10 @@ def test08b(self):
# Append new rows
s0, s1, s2, s3 = ['dbe']*3, ['ded']*3, ['db1']*3, ['de1']*3
f0, f1, f2, f3 = [[1.2]*2]*3, [[1.3]*2]*3, [[1.4]*2]*3, [[1.5]*2]*3
- r = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1]],
+ r = records.array([([456, 457], s0, f0), ([2, 3], s1, f1)],
formats="(2,)i4,(3,)a3,(3,2)f8")
table.append(r)
- table.append([[[457, 458], s2, f2], [[5, 6], s3, f3]])
+ table.append([([457, 458], s2, f2), ([5, 6], s3, f3)])
# Modify just one existing column
columns = records.fromarrays(
@@ -1160,8 +1160,8 @@ def test08b(self):
table.modify_columns(start=1, columns=columns, names=["col1"])
# Create the modified recarray
- r1 = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1],
- [[3, 4], s2, f2], [[4, 5], s3, f3]],
+ r1 = records.array([([456, 457], s0, f0), ([2, 3], s1, f1),
+ ([3, 4], s2, f2), ([4, 5], s3, f3)],
formats="(2,)i4,(3,)a3,(3,2)f8",
names="col1,col2,col3")
@@ -1187,10 +1187,10 @@ def test08b2(self):
# Append new rows
s0, s1, s2, s3 = ['dbe']*3, ['ded']*3, ['db1']*3, ['de1']*3
f0, f1, f2, f3 = [[1.2]*2]*3, [[1.3]*2]*3, [[1.4]*2]*3, [[1.5]*2]*3
- r = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1]],
+ r = records.array([([456, 457], s0, f0), ([2, 3], s1, f1)],
formats="(2,)i4,(3,)a3,(3,2)f8")
table.append(r)
- table.append([[[457, 458], s2, f2], [[5, 6], s3, f3]])
+ table.append([([457, 458], s2, f2), ([5, 6], s3, f3)])
# Modify just one existing column
columns = records.fromarrays(
@@ -1198,8 +1198,8 @@ def test08b2(self):
table.modify_column(start=1, column=columns, colname="col1")
# Create the modified recarray
- r1 = records.array([[[456, 457], s0, f0], [[2, 3], s1, f1],
- [[3, 4], s2, f2], [[4, 5], s3, f3]],
+ r1 = records.array([([456, 457], s0, f0), ([2, 3], s1, f1),
+ ([3, 4], s2, f2), ([4, 5], s3, f3)],
formats="(2,)i4,(3,)a3,(3,2)f8",
names="col1,col2,col3")
@@ -1235,12 +1235,12 @@ def test00(self):
table.flush()
# Create a recarray with the same default values
- buffer = [[
+ buffer = [(
["\x00"]*2, # just "" does not initialize the buffer properly
[["abcd", "efgh"]]*2,
(1, 1),
((1, 1), (1, 1)),
- 2, 3.1, 4.2, 5, "e"]]
+ 2, 3.1, 4.2, 5, "e")]
r = np.rec.array(
buffer * nrows,
formats='(2,)a4,(2,2)a4,(2,)i4,(2,2)i4,i2,f8,f4,u2,a1',
@@ -1374,17 +1374,17 @@ def test01(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing row
table[2] = (456, 'db2', 1.2)
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [456, 'db2', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (456, 'db2', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
# Read the modified table
@@ -1406,17 +1406,17 @@ def test01b(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing row
table[2] = (456, 'db2', 1.2)
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [456, 'db2', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (456, 'db2', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1439,19 +1439,19 @@ def test02(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, 'db1', 1.2]],
+ rows = records.array([(457, 'db1', 1.2)],
formats=formats)
table[1:3:2] = rows
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [457, 'db1', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1474,21 +1474,21 @@ def test03(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, 'db1', 1.2], [5, 'de1', 1.3]],
+ rows = records.array([(457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats)
# table.modify_rows(start=1, rows=rows)
table[1:3] = rows
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [5, 'de1', 1.3], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (5, 'de1', 1.3), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1511,20 +1511,20 @@ def test04(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
- rows = records.array([[457, 'db1', 1.2], [6, 'de2', 1.3]],
+ rows = records.array([(457, 'db1', 1.2), (6, 'de2', 1.3)],
formats=formats)
# table[1:4:2] = rows
table[1::2] = rows
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [457, 'db1', 1.2], [6, 'de2', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (457, 'db1', 1.2), (6, 'de2', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1547,17 +1547,17 @@ def test05(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1] = -1
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [-1, 'ded', 1.3],
- [457, 'db1', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (-1, 'ded', 1.3),
+ (457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1580,17 +1580,17 @@ def test06a(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4] = [(2, 2), (3, 3), (4, 4)]
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [3, 'db1', 1.2], [4, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (3, 'db1', 1.2), (4, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
# Read the modified table
@@ -1612,10 +1612,10 @@ def test06b(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
with self.assertRaises(NotImplementedError):
@@ -1631,17 +1631,17 @@ def test07(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 1, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 1, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4:2] = [(2, 2), (3, 3)]
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [457, 'db1', 1.2], [3, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (457, 'db1', 1.2), (3, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1664,17 +1664,17 @@ def test08(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
table.cols.col1[1:4:3] = [(2, 2)]
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [457, 'db1', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1697,20 +1697,20 @@ def test09(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Try to modify beyond the extend
# This will silently exclude the non-fitting rows
- rows = records.array([[457, 'db1', 1.2], [6, 'de2', 1.3]],
+ rows = records.array([(457, 'db1', 1.2), (6, 'de2', 1.3)],
formats=formats)
table[1::2] = rows
# How it should look like
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [457, 'db1', 1.2], [6, 'de2', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (457, 'db1', 1.2), (6, 'de2', 1.3)],
formats=formats)
# Read the modified table
@@ -1763,10 +1763,10 @@ def test01(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3]],
+ r = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3)],
formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing row
for row in table.iterrows(2, 3):
@@ -1774,8 +1774,8 @@ def test01(self):
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [456, 'db2', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (456, 'db2', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1798,22 +1798,22 @@ def test02(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, 3, 2):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 3:
- (row['col1'], row['col2'], row['col3']) = [6, 'de2', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (6, 'de2', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [457, 'db1', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1836,22 +1836,22 @@ def test03(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, 3):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 2:
- (row['col1'], row['col2'], row['col3']) = [5, 'de1', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (5, 'de1', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [5, 'de1', 1.3], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (5, 'de1', 1.3), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1874,22 +1874,22 @@ def test04(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify two existing rows
for row in table.iterrows(1, stop=4, step=2):
if row.nrow == 1:
- (row['col1'], row['col2'], row['col3']) = [457, 'db1', 1.2]
+ (row['col1'], row['col2'], row['col3']) = (457, 'db1', 1.2)
elif row.nrow == 3:
- (row['col1'], row['col2'], row['col3']) = [6, 'de2', 1.3]
+ (row['col1'], row['col2'], row['col3']) = (6, 'de2', 1.3)
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [457, 'db1', 1.2],
- [457, 'db1', 1.2], [6, 'de2', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (457, 'db1', 1.2),
+ (457, 'db1', 1.2), (6, 'de2', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1912,10 +1912,10 @@ def test05(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
for row in table.iterrows(1, 2):
@@ -1923,8 +1923,8 @@ def test05(self):
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [-1, 'ded', 1.3],
- [457, 'db1', 1.2], [5, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (-1, 'ded', 1.3),
+ (457, 'db1', 1.2), (5, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1947,10 +1947,10 @@ def test06(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 2, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 2, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just one existing column
for row in table.iterrows(1, 4):
@@ -1958,8 +1958,8 @@ def test06(self):
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ded', 1.3],
- [3, 'db1', 1.2], [4, 'de1', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ded', 1.3),
+ (3, 'db1', 1.2), (4, 'de1', 1.3)],
formats=formats,
names="col1,col2,col3")
@@ -1982,10 +1982,10 @@ def test07(self):
formats = table.description._v_nested_formats
# append new rows
- r = records.array([[456, 'dbe', 1.2], [
- 1, 'ded', 1.3]], formats=formats)
+ r = records.array([(456, 'dbe', 1.2), (
+ 1, 'ded', 1.3)], formats=formats)
table.append(r)
- table.append([[457, 'db1', 1.2], [5, 'de1', 1.3]])
+ table.append([(457, 'db1', 1.2), (5, 'de1', 1.3)])
# Modify just rows with col1 < 456
for row in table.iterrows():
@@ -1995,8 +1995,8 @@ def test07(self):
row.update()
# Create the modified recarray
- r1 = records.array([[456, 'dbe', 1.2], [2, 'ada', 1.3],
- [457, 'db1', 1.2], [2, 'ada', 1.3]],
+ r1 = records.array([(456, 'dbe', 1.2), (2, 'ada', 1.3),
+ (457, 'db1', 1.2), (2, 'ada', 1.3)],
formats=formats,
names="col1,col2,col3")