Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_auto_ragged_array(self):
df = pd.DataFrame({'a': [[1], [1, 2]]})
df2 = DynamicTable.from_dataframe(df, name='test').to_dataframe()
df.equals(df2)
def with_columns_and_data(self):
columns = [
VectorData(name=s['name'], description=s['description'], data=d)
for s, d in zip(self.spec, self.data)
]
return DynamicTable("with_columns_and_data", 'a test table', columns=columns)
def test_constructor_ids_bad_ids(self):
columns = [VectorData(name=s['name'], description=s['description'], data=d)
for s, d in zip(self.spec, self.data)]
msg = "must provide same number of ids as length of columns"
with self.assertRaisesRegex(ValueError, msg):
DynamicTable("with_columns", 'a test table', id=[0, 1], columns=columns)
def test_constructor_ids(self):
columns = [VectorData(name=s['name'], description=s['description'], data=d)
for s, d in zip(self.spec, self.data)]
table = DynamicTable("with_columns", 'a test table', id=[0, 1, 2, 3, 4], columns=columns)
self.check_table(table)
def with_spec(self):
table = DynamicTable("with_spec", 'a test table', columns=self.spec)
return table
def test_constructor_ids_default(self):
columns = [VectorData(name=s['name'], description=s['description'], data=d)
for s, d in zip(self.spec, self.data)]
table = DynamicTable("with_spec", 'a test table', columns=columns)
self.check_table(table)
def with_columns_and_data(self):
columns = [
VectorData(name=s['name'], description=s['description'], data=d)
for s, d in zip(self.spec, self.data)
]
return DynamicTable("with_columns_and_data", 'a test table', columns=columns)