Пример #1
0
    def handle(self, *args, **kwargs):
        if len(args) != 1:
            raise CommandError("Specify a single JSON file path.")
        import myjson
        all = myjson.loads(open(args[0]).read())

        self.import_problems(all)
def test_json_round_trip(data):
    """
    Encoding a thing as JSON and decoding it again returns the same thing.

    (This will fail for input that contains tuples, but we don't test that.)
    """
    assert data == myjson.loads(myjson.dumps(data))
Пример #3
0
def test_loading_from_file(description, filename):
    filename = os.path.join(os.path.dirname(__file__), filename)
    with open(filename) as f:
        string = f.read()
        assert myjson.loads(string) == json.loads(string)
Пример #4
0
def test_loading(description, string):
    assert myjson.loads(string) == json.loads(string)
def test_json_oracle(json_text):
    """
    The new thing behaves the same as the old thing.
    """
    assert json.loads(json_text) == myjson.loads(json_text)