Best Python code snippet using tox_python
test_project.py
Source:test_project.py
1# DearEIS is licensed under the GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.html).2# Copyright 2022 DearEIS developers3#4# This program is free software: you can redistribute it and/or modify5# it under the terms of the GNU General Public License as published by6# the Free Software Foundation, either version 3 of the License, or7# (at your option) any later version.8#9# This program is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12# GNU General Public License for more details.13#14# You should have received a copy of the GNU General Public License15# along with this program. If not, see <https://www.gnu.org/licenses/>.16#17# The licenses of DearEIS' dependencies and/or sources of portions of code are included in18# the LICENSES folder.19from os.path import dirname, exists, join20from typing import (21 Dict,22 List,23)24from unittest import TestCase25from numpy import ndarray26import deareis27from deareis import (28 DataSet,29 FitResult,30 Project,31 TestResult,32 SimulationResult,33 PlotSettings,34 PlotSeries,35 PlotType,36)37TEST_PROJECT_PATHS: List[str] = list(38 map(39 lambda _: join(dirname(__file__), _),40 [41 "example-project-v1.json",42 "example-project-v2.json",43 "example-project-v3.json",44 "example-project-v4.json",45 ],46 )47)48TEST_DATA_PATHS: List[str] = list(49 map(50 lambda _: join(dirname(__file__), _),51 [52 "data-1.idf",53 "data-2.csv",54 ],55 )56)57# TODO: Refactor tests58class TestUtility(TestCase):59 def test_01_instantiation(self):60 project: Project = Project()61 self.assertEqual(len(project.get_data_sets()), 0)62 self.assertEqual(len(project.get_all_tests()), 0)63 self.assertEqual(len(project.get_all_fits()), 0)64 self.assertEqual(len(project.get_simulations()), 0)65 self.assertEqual(len(project.get_plots()), 1)66 path: str67 for path in TEST_PROJECT_PATHS:68 self.assertTrue(exists(path))69 project = Project.from_file(path)70 def test_02_merge(self):71 project: Project = Project.merge(72 list(map(lambda _: Project.from_file(_), TEST_PROJECT_PATHS))73 )74 def test_03_label(self):75 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])76 old_label: str = project.get_label()77 self.assertEqual(old_label, "Example project - Version 4")78 new_label: str = "Test label"79 project.set_label(new_label)80 self.assertEqual(project.get_label(), new_label)81 self.assertRaises(AssertionError, lambda: project.set_label(""))82 self.assertRaises(AssertionError, lambda: project.set_label(" \t"))83 def test_04_path(self):84 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])85 old_path: str = project.get_path()86 self.assertTrue(old_path.endswith("example-project-v4.json"))87 new_path: str = "Testing"88 project.set_path(new_path)89 self.assertEqual(project.get_path(), new_path)90 def test_05_notes(self):91 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])92 old_notes: str = project.get_notes()93 self.assertEqual(old_notes, "This is for keeping notes about the project.")94 new_notes: str = "Lorem ipsum"95 project.set_notes(new_notes)96 self.assertEqual(project.get_notes(), new_notes)97 def test_06_data_set(self):98 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])99 data_sets: List[DataSet] = project.get_data_sets()100 self.assertEqual(type(data_sets), list)101 self.assertTrue(all(map(lambda _: type(_) is DataSet, data_sets)))102 self.assertEqual(len(data_sets), 2)103 data: DataSet = deareis.parse_data(TEST_DATA_PATHS[0])[0]104 project.add_data_set(data)105 data_sets = project.get_data_sets()106 self.assertEqual(len(data_sets), 3)107 self.assertEqual(data_sets[2].get_label(), "Test")108 new_label: str = "ABC"109 project.edit_data_set_label(data, new_label)110 self.assertEqual(data.get_label(), new_label)111 data_sets = project.get_data_sets()112 self.assertEqual(len(data_sets), 3)113 self.assertTrue(data.get_label() == data_sets[0].get_label() == new_label)114 new_path: str = "XYZ"115 project.edit_data_set_path(data, new_path)116 self.assertTrue(data.get_path() == data_sets[0].get_path() == new_path)117 old_data: DataSet = data118 new_data: DataSet = deareis.parse_data(TEST_DATA_PATHS[1])[0]119 self.assertRaises(120 AssertionError, lambda: project.replace_data_set(old_data, new_data)121 )122 new_data.uuid = old_data.uuid123 project.replace_data_set(old_data, new_data)124 data_sets = project.get_data_sets()125 self.assertEqual(len(data_sets), 3)126 self.assertTrue(new_data.get_label() == data_sets[2].get_label() == "data-2")127 project.delete_data_set(new_data)128 data_sets = project.get_data_sets()129 self.assertEqual(len(data_sets), 2)130 def test_07_tests(self):131 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])132 tests: Dict[str, List[TestResult]] = project.get_all_tests()133 self.assertEqual(type(tests), dict)134 self.assertEqual(len(tests), 2)135 self.assertTrue(all(map(lambda _: type(_) is list, tests.values())))136 self.assertTrue(137 all(map(lambda _: type(_) is TestResult, list(tests.values())[0]))138 )139 data_sets: List[DataSet] = project.get_data_sets()140 data: DataSet141 for data in data_sets:142 self.assertTrue(data.uuid in tests)143 data_tests: List[TestResult] = project.get_tests(data_sets[0])144 self.assertEqual(type(data_tests), list)145 self.assertEqual(len(data_tests), 1)146 self.assertEqual(type(data_tests[0]), TestResult)147 project.delete_test(data_sets[0], data_tests[0])148 data_tests = project.get_tests(data_sets[0])149 self.assertEqual(len(data_tests), 0)150 project.delete_data_set(data_sets[0])151 tests = project.get_all_tests()152 self.assertEqual(len(tests), 1)153 data: DataSet = deareis.parse_data(TEST_DATA_PATHS[1])[0]154 project.add_data_set(data)155 project.add_test(data, list(tests.values())[0][0])156 tests = project.get_all_tests()157 self.assertEqual(len(tests), 2)158 self.assertEqual(len(list(tests.values())[1]), 1)159 def test_08_fits(self):160 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])161 fits: Dict[str, List[FitResult]] = project.get_all_fits()162 self.assertEqual(type(fits), dict)163 self.assertEqual(len(fits), 2)164 self.assertTrue(all(map(lambda _: type(_) is list, fits.values())))165 self.assertTrue(166 all(map(lambda _: type(_) is FitResult, list(fits.values())[0]))167 )168 data_sets: List[DataSet] = project.get_data_sets()169 data: DataSet170 for data in data_sets:171 self.assertTrue(data.uuid in fits)172 data_fits: List[FitResult] = project.get_fits(data_sets[0])173 self.assertEqual(type(data_fits), list)174 self.assertEqual(len(data_fits), 1)175 self.assertEqual(type(data_fits[0]), FitResult)176 project.delete_fit(data_sets[0], data_fits[0])177 data_fits = project.get_fits(data_sets[0])178 self.assertEqual(len(data_fits), 0)179 project.delete_data_set(data_sets[0])180 fits = project.get_all_fits()181 self.assertEqual(len(fits), 1)182 data: DataSet = deareis.parse_data(TEST_DATA_PATHS[1])[0]183 project.add_data_set(data)184 project.add_fit(data, list(fits.values())[0][0])185 fits = project.get_all_fits()186 self.assertEqual(len(fits), 2)187 self.assertEqual(len(list(fits.values())[1]), 1)188 def test_09_simulations(self):189 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])190 sims: List[SimulationResult] = project.get_simulations()191 self.assertEqual(type(sims), list)192 self.assertEqual(len(sims), 2)193 self.assertTrue(all(map(lambda _: type(_) is SimulationResult, sims)))194 sim: SimulationResult = sims[0]195 project.delete_simulation(sim)196 sims = project.get_simulations()197 self.assertEqual(len(sims), 1)198 project.add_simulation(sim)199 sims = project.get_simulations()200 self.assertEqual(len(sims), 2)201 def test_10_plots(self):202 project: Project = Project.from_file(TEST_PROJECT_PATHS[-1])203 plots: List[PlotSettings] = project.get_plots()204 self.assertEqual(type(plots), list)205 self.assertEqual(len(plots), 5)206 self.assertTrue(all(map(lambda _: type(_) is PlotSettings, plots)))207 new_label: str = "Test"208 project.edit_plot_label(plots[0], new_label)209 plots = project.get_plots()210 plot: PlotSettings = plots[4]211 self.assertEqual(plot.get_label(), new_label)212 project.delete_plot(plot)213 plots = project.get_plots()214 self.assertEqual(len(plots), 4)215 self.assertTrue(not any(map(lambda _: _.get_label() == new_label, plots)))216 project.add_plot(plot)217 plots = project.get_plots()218 self.assertEqual(len(plots), 5)219 self.assertEqual(plots[4].get_label(), new_label)220 series: List[PlotSeries] = project.get_plot_series(plot)221 self.assertEqual(type(series), list)222 self.assertEqual(len(series), 16)223 self.assertTrue(all(map(lambda _: type(_) is PlotSeries, series)))224 def test_11_version_1(self):225 # TODO: Add more detailed tests226 path: str = TEST_PROJECT_PATHS[0]227 project: Project = Project.from_file(path)228 self.assertEqual(project.get_path(), path)229 self.assertEqual(project.get_label(), "Example project - Version 1")230 # - data sets231 datasets: List[DataSet] = project.get_data_sets()232 self.assertEqual(type(datasets), list)233 self.assertEqual(len(datasets), 2)234 self.assertTrue(all(map(lambda _: type(_) is DataSet, datasets)))235 # - tests236 tests: List[TestResult] = project.get_tests(datasets[0])237 self.assertEqual(type(tests), list)238 self.assertEqual(len(tests), 1)239 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))240 tests = project.get_tests(datasets[1])241 self.assertEqual(type(tests), list)242 self.assertEqual(len(tests), 1)243 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))244 # - fits245 fits: List[FitResult] = project.get_fits(datasets[0])246 self.assertEqual(type(fits), list)247 self.assertEqual(len(fits), 1)248 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))249 fits = project.get_fits(datasets[1])250 self.assertEqual(type(fits), list)251 self.assertEqual(len(fits), 1)252 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))253 # - simulations254 simulations: List[SimulationResult] = project.get_simulations()255 self.assertEqual(type(simulations), list)256 self.assertEqual(len(simulations), 2)257 self.assertTrue(all(map(lambda _: type(_) is SimulationResult, simulations)))258 # - plots259 plots: List[PlotSettings] = project.get_plots()260 self.assertEqual(type(plots), list)261 self.assertEqual(len(plots), 1)262 def test_12_version_2(self):263 # TODO: Add more detailed tests264 path: str = TEST_PROJECT_PATHS[1]265 project: Project = Project.from_file(path)266 self.assertEqual(project.get_path(), path)267 self.assertEqual(project.get_label(), "Example project - Version 2")268 # - data sets269 datasets: List[DataSet] = project.get_data_sets()270 self.assertEqual(type(datasets), list)271 self.assertEqual(len(datasets), 2)272 self.assertTrue(all(map(lambda _: type(_) is DataSet, datasets)))273 # - tests274 tests: List[TestResult] = project.get_tests(datasets[0])275 self.assertEqual(type(tests), list)276 self.assertEqual(len(tests), 1)277 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))278 tests = project.get_tests(datasets[1])279 self.assertEqual(type(tests), list)280 self.assertEqual(len(tests), 1)281 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))282 # - fits283 fits: List[FitResult] = project.get_fits(datasets[0])284 self.assertEqual(type(fits), list)285 self.assertEqual(len(fits), 1)286 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))287 fits = project.get_fits(datasets[1])288 self.assertEqual(type(fits), list)289 self.assertEqual(len(fits), 1)290 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))291 # - simulations292 simulations: List[SimulationResult] = project.get_simulations()293 self.assertEqual(type(simulations), list)294 self.assertEqual(len(simulations), 2)295 self.assertTrue(all(map(lambda _: type(_) is SimulationResult, simulations)))296 # - plots297 plots: List[PlotSettings] = project.get_plots()298 self.assertEqual(type(plots), list)299 self.assertEqual(len(plots), 3)300 #301 plot: PlotSettings = plots[0]302 self.assertEqual(plot.get_label(), "Appearance template")303 self.assertEqual(plot.get_type(), PlotType.NYQUIST)304 plot_series: List[PlotSeries] = project.get_plot_series(plot)305 series: PlotSeries = plot_series[0]306 self.assertEqual(series.get_label(), "Ideal data")307 # TODO: Implement tests for getting data (e.g., for Nyquist plots)308 self.assertEqual(type(series.get_color()), tuple)309 self.assertEqual(len(series.get_color()), 4)310 self.assertEqual(series.has_markers(), True)311 self.assertEqual(series.has_line(), False)312 series = plot_series[1]313 self.assertEqual(series.get_label(), "Noisy data")314 # TODO: Implement tests for getting data (e.g., for Nyquist plots)315 self.assertEqual(type(series.get_color()), tuple)316 self.assertEqual(len(series.get_color()), 4)317 self.assertEqual(series.has_markers(), True)318 self.assertEqual(series.has_line(), False)319 series = plot_series[2]320 # TODO: Implement tests for getting data (e.g., for Nyquist plots)321 self.assertEqual(type(series.get_color()), tuple)322 self.assertEqual(len(series.get_color()), 4)323 self.assertEqual(series.has_markers(), True)324 self.assertEqual(series.has_line(), True)325 #326 plot = plots[1]327 self.assertEqual(plot.get_label(), "Ideal")328 self.assertEqual(plot.get_type(), PlotType.NYQUIST)329 #330 plot = plots[2]331 self.assertEqual(plot.get_label(), "Noisy")332 self.assertEqual(plot.get_type(), PlotType.NYQUIST)333 plot_series = project.get_plot_series(plot)334 series = plot_series[0]335 label: str = series.get_label()336 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")337 # TODO: Implement tests for getting data (e.g., for Nyquist plots)338 self.assertEqual(type(series.get_color()), tuple)339 self.assertEqual(len(series.get_color()), 4)340 self.assertEqual(series.has_markers(), False)341 self.assertEqual(series.has_line(), True)342 series = plot_series[1]343 label = series.get_label()344 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")345 # TODO: Implement tests for getting data (e.g., for Nyquist plots)346 self.assertEqual(type(series.get_color()), tuple)347 self.assertEqual(len(series.get_color()), 4)348 self.assertEqual(series.has_markers(), True)349 self.assertEqual(series.has_line(), True)350 series = plot_series[2]351 self.assertEqual(series.get_label(), "Noisy data")352 # TODO: Implement tests for getting data (e.g., for Nyquist plots)353 self.assertEqual(type(series.get_color()), tuple)354 self.assertEqual(len(series.get_color()), 4)355 self.assertEqual(series.has_markers(), True)356 self.assertEqual(series.has_line(), False)357 def test_13_version_3(self):358 # TODO: Add more detailed tests359 path: str = TEST_PROJECT_PATHS[2]360 project: Project = Project.from_file(path)361 self.assertEqual(project.get_path(), path)362 self.assertEqual(project.get_label(), "Example project - Version 3")363 # - data sets364 datasets: List[DataSet] = project.get_data_sets()365 self.assertEqual(type(datasets), list)366 self.assertEqual(len(datasets), 2)367 self.assertTrue(all(map(lambda _: type(_) is DataSet, datasets)))368 # - tests369 tests: List[TestResult] = project.get_tests(datasets[0])370 self.assertEqual(type(tests), list)371 self.assertEqual(len(tests), 1)372 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))373 tests = project.get_tests(datasets[1])374 self.assertEqual(type(tests), list)375 self.assertEqual(len(tests), 1)376 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))377 # - fits378 fits: List[FitResult] = project.get_fits(datasets[0])379 self.assertEqual(type(fits), list)380 self.assertEqual(len(fits), 1)381 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))382 fits = project.get_fits(datasets[1])383 self.assertEqual(type(fits), list)384 self.assertEqual(len(fits), 1)385 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))386 # - simulations387 simulations: List[SimulationResult] = project.get_simulations()388 self.assertEqual(type(simulations), list)389 self.assertEqual(len(simulations), 2)390 self.assertTrue(all(map(lambda _: type(_) is SimulationResult, simulations)))391 # - plots392 plots: List[PlotSettings] = project.get_plots()393 self.assertEqual(type(plots), list)394 self.assertEqual(len(plots), 3)395 #396 plot: PlotSettings = plots[0]397 self.assertEqual(plot.get_label(), "Appearance template")398 self.assertEqual(plot.get_type(), PlotType.NYQUIST)399 plot_series: List[PlotSeries] = project.get_plot_series(plot)400 series: PlotSeries = plot_series[0]401 self.assertEqual(series.get_label(), "Ideal data")402 # TODO: Implement tests for getting data (e.g., for Nyquist plots)403 self.assertEqual(type(series.get_color()), tuple)404 self.assertEqual(len(series.get_color()), 4)405 self.assertEqual(series.has_markers(), True)406 self.assertEqual(series.has_line(), False)407 series = plot_series[1]408 self.assertEqual(series.get_label(), "Noisy data")409 # TODO: Implement tests for getting data (e.g., for Nyquist plots)410 self.assertEqual(type(series.get_color()), tuple)411 self.assertEqual(len(series.get_color()), 4)412 self.assertEqual(series.has_markers(), True)413 self.assertEqual(series.has_line(), False)414 series = plot_series[2]415 # TODO: Implement tests for getting data (e.g., for Nyquist plots)416 self.assertEqual(type(series.get_color()), tuple)417 self.assertEqual(len(series.get_color()), 4)418 self.assertEqual(series.has_markers(), True)419 self.assertEqual(series.has_line(), True)420 #421 plot = plots[1]422 self.assertEqual(plot.get_label(), "Ideal")423 self.assertEqual(plot.get_type(), PlotType.NYQUIST)424 #425 plot = plots[2]426 self.assertEqual(plot.get_label(), "Noisy")427 self.assertEqual(plot.get_type(), PlotType.NYQUIST)428 plot_series = project.get_plot_series(plot)429 series = plot_series[0]430 label: str = series.get_label()431 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")432 # TODO: Implement tests for getting data (e.g., for Nyquist plots)433 self.assertEqual(type(series.get_color()), tuple)434 self.assertEqual(len(series.get_color()), 4)435 self.assertEqual(series.has_markers(), False)436 self.assertEqual(series.has_line(), True)437 series = plot_series[1]438 label = series.get_label()439 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")440 # TODO: Implement tests for getting data (e.g., for Nyquist plots)441 self.assertEqual(type(series.get_color()), tuple)442 self.assertEqual(len(series.get_color()), 4)443 self.assertEqual(series.has_markers(), True)444 self.assertEqual(series.has_line(), True)445 series = plot_series[2]446 self.assertEqual(series.get_label(), "Noisy data")447 # TODO: Implement tests for getting data (e.g., for Nyquist plots)448 self.assertEqual(type(series.get_color()), tuple)449 self.assertEqual(len(series.get_color()), 4)450 self.assertEqual(series.has_markers(), True)451 self.assertEqual(series.has_line(), False)452 def test_14_version_4(self):453 # TODO: Add more detailed tests454 path: str = TEST_PROJECT_PATHS[3]455 project: Project = Project.from_file(path)456 self.assertEqual(project.get_path(), path)457 self.assertEqual(project.get_label(), "Example project - Version 4")458 # - data sets459 datasets: List[DataSet] = project.get_data_sets()460 self.assertEqual(type(datasets), list)461 self.assertEqual(len(datasets), 2)462 self.assertTrue(all(map(lambda _: type(_) is DataSet, datasets)))463 # - tests464 tests: List[TestResult] = project.get_tests(datasets[0])465 self.assertEqual(type(tests), list)466 self.assertEqual(len(tests), 1)467 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))468 tests = project.get_tests(datasets[1])469 self.assertEqual(type(tests), list)470 self.assertEqual(len(tests), 1)471 self.assertTrue(all(map(lambda _: type(_) is TestResult, tests)))472 # - fits473 fits: List[FitResult] = project.get_fits(datasets[0])474 self.assertEqual(type(fits), list)475 self.assertEqual(len(fits), 1)476 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))477 fits = project.get_fits(datasets[1])478 self.assertEqual(type(fits), list)479 self.assertEqual(len(fits), 1)480 self.assertTrue(all(map(lambda _: type(_) is FitResult, fits)))481 # - simulations482 simulations: List[SimulationResult] = project.get_simulations()483 self.assertEqual(type(simulations), list)484 self.assertEqual(len(simulations), 2)485 self.assertTrue(all(map(lambda _: type(_) is SimulationResult, simulations)))486 # - plots487 plots: List[PlotSettings] = project.get_plots()488 self.assertEqual(type(plots), list)489 self.assertEqual(len(plots), 5)490 #491 plot: PlotSettings = plots[0]492 self.assertEqual(plot.get_label(), "Appearance template")493 self.assertEqual(plot.get_type(), PlotType.NYQUIST)494 plot_series: List[PlotSeries] = project.get_plot_series(plot)495 series: PlotSeries = plot_series[0]496 self.assertEqual(series.get_label(), "Ideal")497 # TODO: Implement tests for getting data (e.g., for Nyquist plots)498 self.assertEqual(type(series.get_color()), tuple)499 self.assertEqual(len(series.get_color()), 4)500 self.assertEqual(series.has_markers(), True)501 self.assertEqual(series.has_line(), False)502 series = plot_series[1]503 self.assertEqual(series.get_label(), "Noisy")504 # TODO: Implement tests for getting data (e.g., for Nyquist plots)505 self.assertEqual(type(series.get_color()), tuple)506 self.assertEqual(len(series.get_color()), 4)507 self.assertEqual(series.has_markers(), True)508 self.assertEqual(series.has_line(), False)509 series = plot_series[2]510 # TODO: Implement tests for getting data (e.g., for Nyquist plots)511 self.assertEqual(type(series.get_color()), tuple)512 self.assertEqual(len(series.get_color()), 4)513 self.assertEqual(series.has_markers(), True)514 self.assertEqual(series.has_line(), True)515 #516 plot = plots[1]517 self.assertEqual(plot.get_label(), "Ideal")518 self.assertEqual(plot.get_type(), PlotType.NYQUIST)519 #520 plot = plots[3]521 self.assertEqual(plot.get_label(), "Noisy")522 self.assertEqual(plot.get_type(), PlotType.NYQUIST)523 plot_series = project.get_plot_series(plot)524 series = plot_series[0]525 label: str = series.get_label()526 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")527 # TODO: Implement tests for getting data (e.g., for Nyquist plots)528 self.assertEqual(type(series.get_color()), tuple)529 self.assertEqual(len(series.get_color()), 4)530 self.assertEqual(series.has_markers(), False)531 self.assertEqual(series.has_line(), True)532 series = plot_series[1]533 label = series.get_label()534 self.assertEqual(label[: label.find(" (")], "R(RC)(RW)")535 # TODO: Implement tests for getting data (e.g., for Nyquist plots)536 self.assertEqual(type(series.get_color()), tuple)537 self.assertEqual(len(series.get_color()), 4)538 self.assertEqual(series.has_markers(), True)539 self.assertEqual(series.has_line(), True)540 series = plot_series[2]541 self.assertEqual(series.get_label(), "Noisy data")542 # TODO: Implement tests for getting data (e.g., for Nyquist plots)543 self.assertEqual(type(series.get_color()), tuple)544 self.assertEqual(len(series.get_color()), 4)545 self.assertEqual(series.has_markers(), True)...
test_project_paths.py
Source:test_project_paths.py
...7from mypythontools_cicd.project_paths import PROJECT_PATHS8from conftest import prepare_test9test_project_path = Path("tests").resolve() / "tested project"10# pylint: disable=missing-function-docstring,11def test_project_paths():12 PROJECT_PATHS.reset_paths()13 assert PROJECT_PATHS.root == test_project_path14 assert PROJECT_PATHS.init == test_project_path / "project_lib" / "__init__.py"15 assert PROJECT_PATHS.app == test_project_path / "project_lib"16 assert PROJECT_PATHS.docs == test_project_path / "docs"17 assert PROJECT_PATHS.readme == test_project_path / "README.md"18 assert PROJECT_PATHS.tests == test_project_path / "tests"19if __name__ == "__main__":20 # Find paths and add to sys.path to be able to import local modules21 prepare_test()...
test_path.py
Source:test_path.py
...8 repo_path.src_path() / '..' / 'tests' / 'test_utils',9 repo_path.test_path() / 'test_utils'10 ]11)12def test_project_paths(path_from_func):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!