def test_from_yml_rep_errors(self): table = Table(num_rows=1, schema=self.TABLE_SCHEMA) for row, column_name, expected_error, expected_error_cause, yml_rep in self.BAD_YML_REPS: print(row, column_name, expected_error) with assert_raises(TableError) as cm: table.from_yml_rep(yml_rep) e = cm.exception assert_equal(e.entry, 0) assert_equal(e.field, column_name) assert_is_instance(e.cause, expected_error) if expected_error_cause: assert_is_instance(e.cause.cause, expected_error_cause)
def test_from_yml_rep_errors(self): table = Table(num_rows=1, schema=self.TABLE_SCHEMA) for row, column_name, expected_error, expected_error_cause, yml_rep in self.BAD_YML_REPS: print row, column_name, expected_error with assert_raises(TableError) as cm: table.from_yml_rep(yml_rep) e = cm.exception assert_equal(e.entry, 0) assert_equal(e.field, column_name) assert_is_instance(e.cause, expected_error) if expected_error_cause: assert_is_instance(e.cause.cause, expected_error_cause)
def test_from_yml_rep(self): table = Table(num_rows=len(self.TABLE_VALUES), schema=self.TABLE_SCHEMA) table.from_yml_rep(self.YML_REP) assert_list_equal(table.values, self.TABLE_VALUES)