示例#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>')
def result_resolver(input):
    formatter = GeneralFormatter()
    return formatter.format(input, '\t')
 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>')
 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