-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v2.0.0' into crnh/v2.0.0/refactor_core
- Loading branch information
Showing
33 changed files
with
1,183 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import re | ||
from inspect import getsource | ||
|
||
import pytest | ||
|
||
from zospy.analyses.new.base import BaseAnalysisWrapper, new_analysis | ||
from zospy.analyses.new.systemviewers.base import SystemViewerWrapper | ||
from zospy.api import constants | ||
from zospy.api.constants import process_constant | ||
|
||
analysis_wrapper_classes = BaseAnalysisWrapper.__subclasses__() | ||
analysis_wrapper_classes.remove(SystemViewerWrapper) | ||
|
||
REGEX_SETTING = re.compile(r"\s*self\.analysis\.Settings\.(?P<setting>\w+)") | ||
|
||
|
||
@pytest.mark.parametrize("analysis_wrapper", analysis_wrapper_classes) | ||
def test_settings_exist(empty_system, analysis_wrapper): | ||
if analysis_wrapper.MODE == "Nonsequential": | ||
empty_system.make_nonsequential() | ||
|
||
analysis = new_analysis(empty_system, process_constant(constants.Analysis.AnalysisIDM, analysis_wrapper.TYPE)) | ||
source = getsource(analysis_wrapper.run_analysis) | ||
|
||
settings = REGEX_SETTING.findall(source) | ||
|
||
nonexistent_settings = [setting for setting in settings if not hasattr(analysis.Settings, setting)] | ||
|
||
assert not nonexistent_settings, f"Nonexistent settings: {nonexistent_settings}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from zospy.analyses.new.extendedscene import GeometricImageAnalysis | ||
|
||
|
||
class TestPolarizationTransmission: | ||
def test_can_run(self, simple_system): | ||
result = GeometricImageAnalysis().run(simple_system) | ||
assert result.data is not None | ||
|
||
def test_to_json(self, simple_system): | ||
result = GeometricImageAnalysis().run(simple_system) | ||
assert result.from_json(result.to_json()).to_json() == result.to_json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from zospy.analyses.new.physicaloptics import PhysicalOpticsPropagation | ||
|
||
|
||
class TestPhysicalOpticsPropagation: | ||
def test_can_run(self, simple_system): | ||
result = PhysicalOpticsPropagation().run(simple_system) | ||
assert result.data is not None | ||
|
||
def test_to_json(self, simple_system): | ||
result = PhysicalOpticsPropagation().run(simple_system) | ||
assert result.from_json(result.to_json()).to_json() == result.to_json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.