Example #1
0
 def test_write(self):
     outFile = os.path.join(self.basePath, 'write.json')
     runPd(os.path.join(self.basePath, 'write.pd'))
     fileHandle = open(outFile)
     out = fileHandle.read();
     try:
         os.remove(outFile);
     except:
         pass
     self.assertEquals(out, '{ "key": 1 }')
Example #2
0
 def test_write(self):
     outFile = os.path.join(self.basePath, 'write.json')
     runPd(os.path.join(self.basePath, 'write.pd'))
     fileHandle = open(outFile)
     out = fileHandle.read()
     try:
         os.remove(outFile)
     except:
         pass
     self.assertEquals(out, '{ "key": 1 }')
Example #3
0
    def test_multiple_members(self):
        out = runPd(os.path.join(self.basePath, 'multiple-members.pd'))
        self.assertEquals(out, '''list key value;
list key2 2;
list key3 0.1;
list bool 0;
bang;
''')
Example #4
0
    def test_array(self):
        out = runPd(os.path.join(self.basePath, 'array.pd'))
        self.assertEquals(out, '''list key value;
list id 1;
bang;
list key value 2;
list id 2;
bang;
''')
Example #5
0
    def test_multiple_members(self):
        out = runPd(os.path.join(self.basePath, 'multiple-members.pd'))
        self.assertEquals(
            out, '''list key value;
list key2 2;
list key3 0.1;
list bool 0;
bang;
''')
Example #6
0
    def test_array(self):
        out = runPd(os.path.join(self.basePath, 'array.pd'))
        self.assertEquals(
            out, '''list key value;
list id 1;
bang;
list key value 2;
list id 2;
bang;
''')
Example #7
0
    def test_read_large(self):
        out = runPd(os.path.join(self.basePath, 'read-large.pd'))
        self.assertFalse(out == '''
''')
Example #8
0
    def test_read(self):
        out = runPd(os.path.join(self.basePath, 'read.pd'))
        self.assertEquals(out, '''list { "key": 1 };
''')
Example #9
0
    def test_read_large(self):
        out = runPd(os.path.join(self.basePath, 'read-large.pd'))
        self.assertFalse(out == '''
''')
Example #10
0
    def test_add_two_values(self):
        out = runPd(os.path.join(self.basePath, 'add-two-values.pd'))
        self.assertEquals(out, '''list key=value&key2=value2;
''')
Example #11
0
    def test_empty_bang(self):
        out = runPd(os.path.join(self.basePath, 'empty-bang.pd'))
        self.assertEquals(out, '''list ;
''')
Example #12
0
    def test_escape_value(self):
        out = runPd(os.path.join(self.basePath, 'escape-value.pd'))
        self.assertEquals(out, '''list key=value%20with%20%23spaces%26other%2bst%c3%bcff%20incl.%20%c3%9cml%c3%a4ute;
''')
Example #13
0
    def test_replace(self):
        out = runPd(os.path.join(self.basePath, 'replace.pd'))
        self.assertEquals(out, '''list { "key": "value2" };
''')
Example #14
0
    def test_simple_object(self):
        out = runPd(os.path.join(self.basePath, 'simple-object.pd'))
        self.assertEquals(out, '''list key value;
bang;
''')
Example #15
0
 def test_add_float(self):
     out = runPd(os.path.join(self.basePath, 'add-float.pd'))
     self.assertTrue(out.startswith('''list { "key": 1.100000'''))
Example #16
0
    def test_add_string(self):
        out = runPd(os.path.join(self.basePath, 'add-string.pd'))
        self.assertEquals(out, '''list { "key": "value" };
''')
Example #17
0
    def test_add_single_value(self):
        out = runPd(os.path.join(self.basePath, 'add-single-value.pd'))
        self.assertEquals(out, '''list key=value;
''')
Example #18
0
    def test_escape_key(self):
        out = runPd(os.path.join(self.basePath, 'escape-key.pd'))
        self.assertEquals(out, '''list key%23%24=value;
''')
Example #19
0
    def test_add_object(self):
        out = runPd(os.path.join(self.basePath, 'add-object.pd'))
        self.assertEquals(out, '''list { "key": { "id": "test"\, "name": "my name" } };
''')
Example #20
0
    def test_replace(self):
        out = runPd(os.path.join(self.basePath, 'replace.pd'))
        self.assertEquals(out, '''list { "key": "value2" };
''')
Example #21
0
    def test_replace_value(self):
        out = runPd(os.path.join(self.basePath, 'replace-value.pd'))
        self.assertEquals(out, '''list key=other;
''')
Example #22
0
 def test_add_float(self):
     out = runPd(os.path.join(self.basePath, 'add-float.pd'))
     self.assertTrue(out.startswith('''list { "key": 1.100000'''))
Example #23
0
    def test_add_array(self):
        out = runPd(os.path.join(self.basePath, 'add-array.pd'))
        self.assertEquals(out, '''list { "key": [ "value"\\, "value2" ] };
''')
Example #24
0
    def test_add_array(self):
        out = runPd(os.path.join(self.basePath, 'add-array.pd'))
        self.assertEquals(out, '''list { "key": [ "value"\\, "value2" ] };
''')
Example #25
0
    def test_add_object(self):
        out = runPd(os.path.join(self.basePath, 'add-object.pd'))
        self.assertEquals(
            out, '''list { "key": { "id": "test"\, "name": "my name" } };
''')
Example #26
0
    def test_clear(self):
        out = runPd(os.path.join(self.basePath, 'clear.pd'))
        self.assertEquals(out, '''list ;
''')
Example #27
0
    def test_clear(self):
        out = runPd(os.path.join(self.basePath, 'clear.pd'))
        self.assertEquals(out, '''list ;
''')
Example #28
0
    def test_add_int(self):
        out = runPd(os.path.join(self.basePath, 'add-int.pd'))
        self.assertEquals(out, '''list { "key": 1 };
''')
Example #29
0
    def test_empty_bang(self):
        out = runPd(os.path.join(self.basePath, 'empty-bang.pd'))
        self.assertEquals(out, '''list ;
''')
Example #30
0
    def test_read(self):
        out = runPd(os.path.join(self.basePath, 'read.pd'))
        self.assertEquals(out, '''list { "key": 1 };
''')
Example #31
0
    def test_add_int(self):
        out = runPd(os.path.join(self.basePath, 'add-int.pd'))
        self.assertEquals(out, '''list { "key": 1 };
''')
Example #32
0
    def test_add_string(self):
        out = runPd(os.path.join(self.basePath, 'add-string.pd'))
        self.assertEquals(out, '''list { "key": "value" };
''')
Example #33
0
    def test_simple_object(self):
        out = runPd(os.path.join(self.basePath, 'simple-object.pd'))
        self.assertEquals(out, '''list key value;
bang;
''')