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

default paramater of Float/IntegerParamter can be initialized incorrectly #3

Open
JCoetzee123 opened this issue Jul 24, 2019 · 0 comments

Comments

@JCoetzee123
Copy link
Contributor

Title

default paramater of Float/IntegerParameter can be initialized incorrectly

Steps to reproduce

  1. Import the SPiRA framework
import spira.all as spira
  1. Create a class accepting a spira.ParameterInitializer and create a simple integer parameter
class Layer(spira.ParameterInitializer):
   integer = spira.IntegerParameter(default="abcd", preprocess=spira.ProcessorInt())
  1. Create a Layer class to be called in the script
layer = Layer()

Current behavior (incorrect)

[SPiRA] Version 0.1.1-Auron [Beta] - MIT License

Expected behavior (correct)

Traceback (most recent call last):
File "tests/createlayer.py", line 25, in
layer.interger = "1.2"
File "/home/johannes/Documents/latestspira 17jul/spira-master/spira/core/parameters/descriptor.py", line 133, in set
v = self.preprocess(value, obj)
File "/home/johannes/Documents/latestspira 17jul/spira-master/spira/core/parameters/processors.py", line 34, in call
return self.process(value, obj)
File "/home/johannes/Documents/latestspira 17jul/spira-master/spira/core/parameters/processors.py", line 93, in process
return self.cast_type(value)
ValueError: invalid literal for int() with base 10: 'abcd'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant