def test_constraints_txt(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "constraints.txt"), '|', os.path.join(dir_path, "constraints2.txt"), '|') self.assertEqual(return_value, nrtDiff.IDENTICAL) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "constraints.txt"), '|', os.path.join(dir_path, "constraints3.txt"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual( message, "nrt_diff/test/constraints.txt: 17 different output values\n\ [ERROR] object BUS_DESC_DIFF_787_U < Umin is in left path but not in right one\n\ [ERROR] object BUS_NAME_DIFF_781_U < Umin is in left path but not in right one\n\ [ERROR] object BUS_TIME_DIFF_787_U < Umin is in left path but not in right one\n\ [ERROR] object BUS_DESC_DIFF_787_U < Umin2 is in right path but not in left one\n\ [ERROR] object BUS_NAME_DIFF2_781_U < Umin is in right path but not in left one\n\ [ERROR] object BUS_ONLY_ON_RIGHT_SIDE_778_U < Umin is in right path but not in left one\n\ [ERROR] object BUS_TIME_DIFF_789_U < Umin is in right path but not in left one\n\ [ERROR] object BUS_DURATION_DIFF_787_U < Umin has different acceptable durations in the two files\n\ [ERROR] object BUS_DURATION_DIFF_NO_TYPE_787_U < Umin has different acceptable durations in the two files\n\ [ERROR] object BUS_KIND_DIFF_787_U < Umin has different kinds in the two files\n\ [ERROR] object BUS_KIND_DIFF_NO_TYPE_787_U < Umin has different kinds in the two files\n\ [ERROR] object BUS_LIMIT_DIFF_787_U < Umin has different limits in the two files\n\ [ERROR] object BUS_LIMIT_DIFF_NO_TYPE_787_U < Umin has different limits in the two files\n\ [ERROR] object BUS_SIDE_DIFF_787_U < Umin has different sides in the two files\n\ [ERROR] object BUS_SIDE_DIFF_NO_TYPE_787_U < Umin has different sides in the two files\n\ [ERROR] object BUS_TYPE_DIFF_787_U < Umin has different types in the two files\n\ [ERROR] values of object BUS_LARGE_VALUE_DIFF_778_U < Umin are different (delta = 2.0) \n" )
def test_timeline_xml(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles(os.path.join(dir_path, "timeline.xml"), '|', os.path.join(dir_path, "timeline2.xml"), '|') self.assertEqual(return_value, nrtDiff.IDENTICAL) (return_value, message) = nrtDiff.CompareTwoFiles(os.path.join(dir_path, "timeline.xml"), '|', os.path.join(dir_path, "timeline3.xml"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual(message, "nrt_diff/test/timeline.xml: 1 difference")
def test_other_xml(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "result.xml"), '|', os.path.join(dir_path, "result2.xml"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual(message, "Problem with result.xml")
def test_log(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "dynawo.log"), '|', os.path.join(dir_path, "dynawo2.log"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual(message, "nrt_diff/test/dynawo.log: 2 differences")
def test_curves_xml(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "curves.xml"), '|', os.path.join(dir_path, "curves2.xml"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual( message, "nrt_diff/test/curves.xml: 1 absolute errors , NETWORK_BELLAP41_U_value" )
def test_curves_different(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "curves.csv"), '|', os.path.join(dir_path, "curves2.csv"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual( message, "nrt_diff/test/curves.csv: 5 absolute errors , GEN____8_SM_generator_UStatorPu , GEN____6_SM_voltageRegulator_EfdPu , GEN____8_SM_voltageRegulator_EfdPu , GEN____1_SM_voltageRegulator_EfdPu , GEN____2_SM_voltageRegulator_EfdPu" )
def test_output_iidm(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "outputIIDM.xml"), '|', os.path.join(dir_path, "outputIIDM2.xml"), '|') self.assertEqual(return_value, nrtDiff.DIFFERENT) self.assertEqual( message, "nrt_diff/test/outputIIDM.xml: 2 different output values\n[ERROR] attribute bus of object BVIL7T 1 (type generator) value: FSLACK11 is not in the equivalent object on right side\n[ERROR] attribute v of object FF11 (type bus) has different values (delta = 1.0) \n" )
def test_output_iidm_powsybl(self): dir_path = os.path.dirname(os.path.realpath(__file__)) (return_value, message) = nrtDiff.CompareTwoFiles( os.path.join(dir_path, "outputIIDMPowSybl.xml"), '|', os.path.join(dir_path, "outputIIDMPowSybl2.xml"), '|') self.assertEqual(return_value, nrtDiff.IDENTICAL)