Beispiel #1
0
 def test_should_not_format_whitespace(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(' ', '\t')
     expect(formattedText).to_equal(None)
Beispiel #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>')
Beispiel #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}')
Beispiel #4
0
 def test_should_not_format_null_input(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(None, '\t')
     expect(formattedText).to_equal(None)
Beispiel #5
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.format(text, options['indent_character'])
     return formattedText
Beispiel #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>')
 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}')
 def test_should_not_format_whitespace(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(' ', '\t')
     expect(formattedText).to_equal(None)
 def test_should_not_format_null_input(self):
     formatter = GeneralFormatter()
     formattedText = formatter.format(None, '\t')
     expect(formattedText).to_equal(None)
 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}')
Beispiel #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}')
Beispiel #15
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.unindent(text)
     return formattedText
Beispiel #16
0
def result_resolver(input):
    formatter = GeneralFormatter()
    return formatter.format(input, '\t')
Beispiel #17
0
 def format(self, text, options):
     formatter = GeneralFormatter()
     formattedText = formatter.format(text, options['indent_character'])
     return formattedText