예제 #1
0
 def test_should_not_format_whitespace(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(' ', '\t')
     expect(formattedText).to_equal(None)
예제 #2
0
 def test_should_identify_and_unindent_basic_xml(self):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent(
         '<root>\n\t<child\na="123"></child>\n</root>')
     expect(formattedText).to_equal('<root><child a="123"></child></root>')
예제 #3
0
 def test_should_identify_and_format_basic_json_with_leading_spaces(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format('  {"hello":"world" ,"value":123}',
                                      '\t')
     expect(formattedText).to_equal(
         '{\n\t"hello": "world",\n\t"value": 123\n}')
예제 #4
0
 def test_should_not_format_null_input(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(None, '\t')
     expect(formattedText).to_equal(None)
예제 #5
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.format(text, options['indent_character'])
     return formattedText
예제 #6
0
 def test_should_identify_and_format_basic_xml(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format('<root><child></child></root>', '\t')
     expect(formattedText).to_equal('<root>\n\t<child></child>\n</root>')
예제 #7
0
def result_resolver(input):
    formatter = GeneralFormatter()
    return formatter.format(input, '\t')
예제 #8
0
 def test_should_identify_and_format_basic_xml(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format('<root><child></child></root>', '\t')
     expect(formattedText).to_equal('<root>\n\t<child></child>\n</root>')
예제 #9
0
 def test_should_identify_and_unindent_basic_xml(self):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent('<root>\n\t<child\na="123"></child>\n</root>')
     expect(formattedText).to_equal('<root><child a="123"></child></root>')
예제 #10
0
 def test_should_identify_and_unindent_basic_json(self):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent('{\n\t"hello": "world",\n\t"value": 123\n}')
     expect(formattedText).to_equal('{"hello":"world","value":123}')
예제 #11
0
 def test_should_not_format_whitespace(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(' ', '\t')
     expect(formattedText).to_equal(None)
예제 #12
0
 def test_should_not_format_null_input(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(None, '\t')
     expect(formattedText).to_equal(None)
예제 #13
0
 def test_should_identify_and_format_basic_json_with_leading_spaces(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format('  {"hello":"world" ,"value":123}', '\t')
     expect(formattedText).to_equal('{\n\t"hello": "world",\n\t"value": 123\n}')
예제 #14
0
 def test_should_identify_and_unindent_basic_json(self):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent(
         '{\n\t"hello": "world",\n\t"value": 123\n}')
     expect(formattedText).to_equal('{"hello":"world","value":123}')
예제 #15
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent(text)
     return formattedText
예제 #16
0
def result_resolver(input):
    formatter = GeneralFormatter()
    return formatter.format(input, '\t')
예제 #17
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.format(text, options['indent_character'])
     return formattedText