-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Gupta <shubhendushekhar.gupta@delta.com>
- Loading branch information
1 parent
05baa59
commit de4caee
Showing
12 changed files
with
182 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules/ | ||
out/ | ||
package-lock.json | ||
package-lock.json | ||
*.tgz |
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
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 @@ | ||
## Python repository for coded json files |
Empty file.
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,20 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
name="coded-json", | ||
version="1.0.0", | ||
author="Shubhendu Shekhar Gupta", | ||
description="Coded JavaScript Object Notation", | ||
long_description="", | ||
author_email="subhendushekhargupta@gmail.com", | ||
package_data=setuptools.find_packages(), | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent" | ||
], | ||
requires=">=3.10", | ||
py_modules=["coded-json"], | ||
package_dir={ '':'cjson/src' }, | ||
include_dirs=[] | ||
) |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
package-lock.json | ||
package-lock.json | ||
*.tgz |
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,46 @@ | ||
const Cjson = require('coded-json').Cjson; | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const cjsonfilePath = path.join(__dirname, "..", "..", "..", "\\test-files\\target.cjson"); | ||
const jsonfilePath = path.join(__dirname, "..", "..", "..", "\\test-files\\source.json"); | ||
const pureJsonfilePath = path.join(__dirname, "..", "..", "..", "\\test-files\\pure.json"); | ||
|
||
/** | ||
* Tests related to CJSON files | ||
*/ | ||
describe("CJSON Test 1", () => { | ||
|
||
it("I should be able to import pure JSON files", () => { | ||
var cjson = new Cjson(pureJsonfilePath); | ||
var pureJSONContent = cjson.deserialize(); | ||
|
||
var jsonStringFromPure = JSON.parse(fs.readFileSync(pureJsonfilePath).toString()); | ||
assert.equal(JSON.stringify(pureJSONContent), JSON.stringify(jsonStringFromPure)); | ||
}); | ||
|
||
it("I should be able to deserialize comments from json files", () => { | ||
var cjson = new Cjson(jsonfilePath); | ||
cjson.deserialize(); | ||
}); | ||
|
||
it("I should be able to deserialize imports and comments", () => { | ||
var cjson = new Cjson(cjsonfilePath); | ||
|
||
var decodedJSON = cjson.deserialize(); | ||
|
||
assert.notEqual(decodedJSON, JSON.parse("{}")) | ||
}); | ||
}); | ||
|
||
/** | ||
* Tests related to native JSON files | ||
*/ | ||
describe("CJSON Test 2", () => { | ||
|
||
it("I should be able to use isContentJson()", () => { | ||
var cjson = new Cjson(pureJsonfilePath); | ||
assert.equal(cjson.isContentJson(), true); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
{ | ||
"quiz": { | ||
"sport": { | ||
"q1": { | ||
"question": "Which one is correct team name in NBA?", | ||
"options": [ | ||
"New York Bulls", | ||
"Los Angeles Kings", | ||
"Golden State Warriros", | ||
"Huston Rocket" | ||
], | ||
"answer": "Huston Rocket" | ||
} | ||
}, | ||
"maths": { | ||
"q1": { | ||
"question": "5 + 7 = ?", | ||
"options": [ | ||
"10", | ||
"11", | ||
"12", | ||
"13" | ||
], | ||
"answer": "12" | ||
} | ||
} | ||
} | ||
} |