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

Remove unused test files #3247

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ protected void testWriteXmlAllPreviousVersions(Network network, ExportOptions ex
testWriteVersionedXml(network, exportOptions, filename, allPreviousVersions(maxVersionExcluded));
}

/**
* Execute a write test for the given network and compare to the given xml reference resource
*/
protected void testWriteXml(Network network, String referencePath) throws IOException {
testWriteXml(network, new ExportOptions(), referencePath);
}

/**
* Execute a write test for the given network and compare to the given xml reference resource
*/
protected void testWriteXml(Network network, ExportOptions exportOptions, String referencePath) throws IOException {
writeXmlTest(network, (n, p) -> NetworkSerDe.write(n, exportOptions, p), referencePath);
}

/**
* Execute a write test for the given network, for all IIDM versions given, and compare to the given versioned xml
* reference test resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import java.io.IOException;

import static com.powsybl.iidm.serde.IidmSerDeConstants.CURRENT_IIDM_VERSION;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
Expand Down Expand Up @@ -43,13 +42,13 @@ void testConversion() throws IOException {

private void testConversion(Network network) throws IOException {

ExportOptions options = new ExportOptions();
testWriteVersionedXml(network, options.setTopologyLevel(TopologyLevel.NODE_BREAKER), "fictitiousSwitchRef.xml", CURRENT_IIDM_VERSION);
testWriteXml(network, "/fictitiousSwitchRef.xml");
Comment on lines -46 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to have no tests on previous versions?

I think the problem here is essentially the fact that only the last version is checked.
Shouldn't we have something like this instead?

testForAllVersionsSince(IidmVersion.V_1_0, v -> {
    try {
        testWriteVersionedXml(network, options.setTopologyLevel(TopologyLevel.NODE_BREAKER), "fictitiousSwitchRef.xml", v);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
});


network.getSwitchStream().forEach(sw -> sw.setRetained(false));
network.getSwitch("BJ").setRetained(true);

testWriteVersionedXml(network, options.setTopologyLevel(TopologyLevel.BUS_BREAKER), "fictitiousSwitchRef-bbk.xml", CURRENT_IIDM_VERSION);
testWriteVersionedXml(network, options.setTopologyLevel(TopologyLevel.BUS_BRANCH), "fictitiousSwitchRef-bbr.xml", CURRENT_IIDM_VERSION);
ExportOptions options = new ExportOptions();
testWriteXml(network, options.setTopologyLevel(TopologyLevel.BUS_BREAKER), "/fictitiousSwitchRef-bbk.xml");
testWriteXml(network, options.setTopologyLevel(TopologyLevel.BUS_BRANCH), "/fictitiousSwitchRef-bbr.xml");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
import java.io.IOException;
import java.util.OptionalDouble;

import static com.powsybl.iidm.serde.IidmSerDeConstants.CURRENT_IIDM_VERSION;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

/**
* @author Ghiles Abdellah {@literal <ghiles.abdellah at rte-france.com>}
Expand All @@ -51,7 +48,7 @@ public void setUp() throws IOException {
void testTargetPLimits() throws IOException {
network.getGenerator("GEN").getExtension(ActivePowerControl.class).setMaxTargetP(800.);
network.getBattery("BAT").getExtension(ActivePowerControl.class).setMinTargetP(10.);
Network network2 = allFormatsRoundTripTest(network, "/activePowerControlWithLimitRoundTripRef.xml", CURRENT_IIDM_VERSION);
Network network2 = allFormatsRoundTripTest(network, "/activePowerControlWithLimitRoundTripRef.xml");

Generator gen2 = network2.getGenerator("GEN");
assertNotNull(gen2);
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading