Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting #1281

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions core/src/test/java/tech/tablesaw/api/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ static void readTables() {
.columnTypes(BUSH_COLUMN_TYPES));
ColumnType[] types = {LOCAL_DATE, SHORT, STRING};
bushMinimized = Table.read().csv(CsvReadOptions.builder("../data/bush.csv").columnTypes(types));
missingValues = Table.read().csv(CsvReadOptions.builder("../data/missing_values.csv")
.missingValueIndicator("-"));
missingValues =
Table.read()
.csv(CsvReadOptions.builder("../data/missing_values.csv").missingValueIndicator("-"));
}

@BeforeEach
Expand Down Expand Up @@ -922,33 +923,40 @@ public void testToStringColumnsWithVaryingSizes() {

@Test
void testCompareRowsIdentical() {
for(int i = 0; i < missingValues.rowCount(); i++) {
assertTrue(Table.compareRows(i, missingValues, missingValues), "Row " + i + " is not equal to itself");
}
for (int i = 0; i < missingValues.rowCount(); i++) {
assertTrue(
Table.compareRows(i, missingValues, missingValues),
"Row " + i + " is not equal to itself");
}
}

@Test
void testCompareRowsDifferent() {
Table differentTable = missingValues.copy().sortDescendingOn("Sales");
for(int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(Table.compareRows(i, missingValues, differentTable), "Row " + i + " is equal to a different row");
}
Table differentTable = missingValues.copy().sortDescendingOn("Sales");
for (int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(
Table.compareRows(i, missingValues, differentTable),
"Row " + i + " is equal to a different row");
}
}

@Test
void testCompareRowsDifferentColumns() {
Table differentTable = missingValues.copy().removeColumns("Sales");
for(int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(Table.compareRows(i, missingValues, differentTable), "Row " + i + " is equal to a row with less columns");
}
Table differentTable = missingValues.copy().removeColumns("Sales");
for (int i = 0; i < missingValues.rowCount(); i++) {
assertFalse(
Table.compareRows(i, missingValues, differentTable),
"Row " + i + " is equal to a row with less columns");
}
}

@Test
void testCompareRowsOutOfBound() {
Table differentTable = missingValues.copy().dropRows(0);
int lastRowNumber = missingValues.rowCount() - 1;
assertThrows(IndexOutOfBoundsException.class,
() -> Table.compareRows(lastRowNumber, missingValues, differentTable),
"Row outside range does not throw exception");
Table differentTable = missingValues.copy().dropRows(0);
int lastRowNumber = missingValues.rowCount() - 1;
assertThrows(
IndexOutOfBoundsException.class,
() -> Table.compareRows(lastRowNumber, missingValues, differentTable),
"Row outside range does not throw exception");
}
}
Loading