You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current error-handling is very rough around the edges. In specific, several test cases are also failing due to incorrect error messages for the types of errors that should be occurring (type error vs nullable type error vs parsing error etc.). Furthermore, the current implementation stores all errors until the entire document has been parsed, then raises an exception with the slew of errors. This can be cleaned up.
Failing Test Cases
======================================================================FAILURES=======================================================================__________________________________________________TestFloatDeclarations.test_catch_null_type_error___________________________________________________self=<test_fable.TestFloatDeclarationsobjectat0x10597dd30>deftest_catch_null_type_error(self):
s='float num null'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.NULLABLE_TYPE_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR: 2>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.NULLABLE_TYPE_ERROR: 2>tests/test_fable.py:67: AssertionError___________________________________________________TestFloatDeclarations.test_catch_parsing_error____________________________________________________self=<test_fable.TestFloatDeclarationsobjectat0x105a2d4e0>deftest_catch_parsing_error(self):
s='float num # woops forgot the value'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.PARSING_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.PARSING_ERROR: 1>tests/test_fable.py:72: AssertionError_________________________________________________________TestFloatDeclarations.test_all_nans_________________________________________________________self=<test_fable.TestFloatDeclarationsobjectat0x105a25630>deftest_all_nans(self):
nans= [
'float num nan',
'float num NaN',
'float num NaN%',
'float num NAN',
'float num NaNQ',
'float num NaNS',
'float num qNaN',
'float num sNaN',
'float num 1.#SNAN',
'float num 1.#QNAN',
'float num +nan.0'
]
fornaninnans:
result=parse_variable_declaration(nan)
>assertisnan(result.value)
EAssertionError: assertFalseE+whereFalse=isnan(1.0)
E+where1.0=Variable(name='num', value=1.0).valuetests/test_fable.py:95: AssertionError__________________________________________________TestFloatDeclarations.test_negative_signed_floats__________________________________________________self=<test_fable.TestFloatDeclarationsobjectat0x105931470>deftest_negative_signed_floats(self):
cases= [
'float num -14.51',
'float num -1.451E01',
'float num -1.451E+01',
'float num -1.451e01',
'float num -1.451e+01'
]
forsincases:
result=parse_variable_declaration(s)
assertresult==Variable('num', -14.51)
cases= [
'float num -0.001451',
'float num -1.451E-03',
'float num -1.451e-03'
]
forsincases:
result=parse_variable_declaration(s)
>assertresult==Variable('num', -0.001451, False)
ETypeError: __init__() takes3positionalargumentsbut4weregiventests/test_fable.py:168: TypeError__________________________________________________TestStringDeclarations.test_catch_null_type_error__________________________________________________self=<test_fable.TestStringDeclarationsobjectat0x10592d7b8>deftest_catch_null_type_error(self):
s='string message null'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.NULLABLE_TYPE_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR: 2>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.NULLABLE_TYPE_ERROR: 2>tests/test_fable.py:226: AssertionError___________________________________________________TestStringDeclarations.test_catch_parsing_error___________________________________________________self=<test_fable.TestStringDeclarationsobjectat0x105920470>deftest_catch_parsing_error(self):
s='string message # woops forgot the value'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.PARSING_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.PARSING_ERROR: 1>tests/test_fable.py:231: AssertionError_________________________________________________TestBooleanDeclarations.test_catch_null_type_error__________________________________________________self=<test_fable.TestBooleanDeclarationsobjectat0x10591b7f0>deftest_catch_null_type_error(self):
s='boolean is_happy null'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.NULLABLE_TYPE_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR: 2>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.NULLABLE_TYPE_ERROR: 2>tests/test_fable.py:257: AssertionError__________________________________________________TestBooleanDeclarations.test_catch_parsing_error___________________________________________________self=<test_fable.TestBooleanDeclarationsobjectat0x1059a37f0>deftest_catch_parsing_error(self):
s='boolean is_happy # woops forgot the rest'result=parse_variable_declaration(s)
>assertresult.code==ErrorCode.PARSING_ERROREassert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>E+<ErrorCode.TYPE_ERROR: 4>E-<ErrorCode.PARSING_ERROR: 1>tests/test_fable.py:262: AssertionError===============================================================shorttestsummaryinfo===============================================================FAILEDtests/test_fable.py::TestFloatDeclarations::test_catch_null_type_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR: 2>FAILEDtests/test_fable.py::TestFloatDeclarations::test_catch_parsing_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>FAILEDtests/test_fable.py::TestFloatDeclarations::test_all_nans-AssertionError: assertFalseFAILEDtests/test_fable.py::TestFloatDeclarations::test_negative_signed_floats-TypeError: __init__() takes3positionalargumentsbut4weregivenFAILEDtests/test_fable.py::TestStringDeclarations::test_catch_null_type_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR: 2>FAILEDtests/test_fable.py::TestStringDeclarations::test_catch_parsing_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>FAILEDtests/test_fable.py::TestBooleanDeclarations::test_catch_null_type_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.NULLABLE_TYPE_ERROR...
FAILEDtests/test_fable.py::TestBooleanDeclarations::test_catch_parsing_error-assert<ErrorCode.TYPE_ERROR: 4>==<ErrorCode.PARSING_ERROR: 1>============================================================8failed, 26passedin0.19s=============================================================
The text was updated successfully, but these errors were encountered:
Current error-handling is very rough around the edges. In specific, several test cases are also failing due to incorrect error messages for the types of errors that should be occurring (type error vs nullable type error vs parsing error etc.). Furthermore, the current implementation stores all errors until the entire document has been parsed, then raises an exception with the slew of errors. This can be cleaned up.
Failing Test Cases
The text was updated successfully, but these errors were encountered: