Closed 1rocketdude closed 6 years ago
Merging #6 into master will decrease coverage by
19.36%
. The diff coverage is78.96%
.
@@ Coverage Diff @@
## master #6 +/- ##
===========================================
- Coverage 99.45% 80.09% -19.37%
===========================================
Files 6 5 -1
Lines 367 427 +60
===========================================
- Hits 365 342 -23
- Misses 2 85 +83
Impacted Files | Coverage Δ | |
---|---|---|
pyetrade/accounts.py | 100% <100%> (ø) |
:arrow_up: |
pyetrade/__init__.py | 100% <100%> (ø) |
:arrow_up: |
pyetrade/authorization.py | 100% <100%> (ø) |
:arrow_up: |
pyetrade/market.py | 38.23% <25.66%> (-61.77%) |
:arrow_down: |
pyetrade/order.py | 98.5% <98.5%> (-1.5%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update d4e14ad...bb522b2. Read the comment docs.
Please just add some unit tests around the options methods and I will merge it. It looks very good thank you for your contribution and feedback.
Jesse,
I admit to being a little frustrated with the unittest module. I can't seem to find the correct syntax for the jxmlease module. I've created test cases for the option modules, but I can't get the test cases to pass because of an error coming from jxmlease.
I'm going to get smart on pytest. It has to be less opaque.
cheers, Tom
On Wed, Oct 10, 2018 at 5:13 AM Jesse Cooper notifications@github.com wrote:
Please just add some unit tests around the options methods and I will merge it. It looks very good thank you for your contribution and feedback.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jessecooper/pyetrade/pull/6#issuecomment-428548348, or mute the thread https://github.com/notifications/unsubscribe-auth/AEmxHJbmiAdKUliBADKckZh-lRaK_j1Wks5ujeRogaJpZM4XKjQn .
I have pulled down your branch and ill take a look. Seems like you only need a few adjustments.
Jesse, I admit to being a little frustrated with the unittest module. I can't seem to find the correct syntax for the jxmlease module. I've created test cases for the option modules, but I can't get the test cases to pass because of an error coming from jxmlease. I'm going to get smart on pytest. It has to be less opaque. cheers, Tom … On Wed, Oct 10, 2018 at 5:13 AM Jesse Cooper @.***> wrote: Please just add some unit tests around the options methods and I will merge it. It looks very good thank you for your contribution and feedback. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#6 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AEmxHJbmiAdKUliBADKckZh-lRaK_j1Wks5ujeRogaJpZM4XKjQn .
Looking at the stack trace from the test failure after changing the mock MockOAuthSession().get().return_value = option_response
it looks like there is an issue in the code:
======================================================================
ERROR: test_get_all_option_data (tests.test_market.TestETradeMarket)
test_get_all_option_data(MockOAuthSession)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/mock.py", line 1179, in patched
return func(*args, **keywargs)
File "/Users/jesse.cooper/Code/Python/pyetrade/tests/test_market.py", line 140, in test_get_all_option_data
self.assertEqual(mark.get_all_option_data(sym), option_response)
File "/Users/jesse.cooper/Code/Python/pyetrade/pyetrade/market.py", line 262, in get_all_option_data
expiry_dates = self.get_optionexpiredate(underlier) # this contains all expiration dates
File "/Users/jesse.cooper/Code/Python/pyetrade/pyetrade/market.py", line 437, in get_optionexpiredate
xmlobj = jxmlease.parse(req.text)
File "/Users/jesse.cooper/Code/Python/pyetrade/env/lib/python3.6/site-packages/jxmlease/xmlparser.py", line 326, in parse
return Parser(**kwargs)(xml_input)
File "/Users/jesse.cooper/Code/Python/pyetrade/env/lib/python3.6/site-packages/jxmlease/xmlparser.py", line 305, in __call__
self._parser.ParseFile(xml_input)
TypeError: argument must have 'read' attribute
req.text returns a unicode string. It looks like the jxmlease.parse() method is looking for some sort of object or dict and not a string object.
addressed the missing option_chains functionality by supplying a market object method get_all_option_data that returns all option_chain information from the production environment.
tweaked the ETradeMarket object API by removing 'dev' variable from all object methods. Thought this cleaned up the code.
Only pyetrade/market.py was modified. All other code was left unchanged.