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

Fix bug in csvToJson method. #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix bug in csvToJson method. #94

wants to merge 1 commit into from

Conversation

YJDave
Copy link

@YJDave YJDave commented Jan 25, 2018

Fixes #93

@codecov-io
Copy link

codecov-io commented Jan 25, 2018

Codecov Report

Merging #94 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #94   +/-   ##
=======================================
  Coverage   62.99%   62.99%           
=======================================
  Files           1        1           
  Lines         254      254           
=======================================
  Hits          160      160           
  Misses         94       94
Impacted Files Coverage Δ
loklak.py 62.99% <0%> (ø) ⬆️

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 ea5f8fc...805f5b7. Read the comment docs.

@@ -84,7 +84,7 @@ def csvToJson(self, csvData = None, fieldnamesList = None):
if csvData:
data = csv.DictReader( csvData, fieldnames = fieldnamesList)
jsonData = json.dumps( [ row for row in data ] )
return out
return jsonData
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the code doesn't enter the csvData if block, it ends up returning '' which is not a valid json. if the JSON is what needs to be returned then ideally it should return {}

Copy link
Author

@YJDave YJDave Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then that should be applied to xmlToJson method too.
This method not at all gives expected output json. Should I change the whole definition of this method?(which can generate right json data from csv)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! Thanks for catching that. Feel free to make a change to that too. 😄

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

Successfully merging this pull request may close these issues.

4 participants