<commit_before>var assert = require("assert")
   ,serializer = require("../lib/serializer")

describe('serializer#xml', function(){
	var doc = [
    '<?xml version="1.0" encoding="UTF-8"?>',
	'<response>',
	' <key type="string">value</key>',
	' <foo type="object">',
	'  <alt type="object">',
	'   <test type="number">1</test>',
	'  </alt>',
	' </foo>',
	' </response>'
	].join('\n')

	it("should do some things 1", function(){
		var s = new serializer({
			defaultFormat:"application/xml"
		});
		s.deserialize(doc, 'text/xml', function( err, content){
			assert.ok( content );
		})
	})

	it('should do other things 2', function(){
		var expected = '<?xml version="1.0" encoding="UTF-8"?>\n<response>\n <key type="string">value</key>\n <foo type="object">\n  <alt type="object">\n   <test type="number">1</test>\n  </alt>\n </foo>\n</response>\n'
		var s = new serializer({
			xmlattr:true
		})
		s.serialize({key:'value', foo:{alt:{test:1}}}, 'text/xml', function(e,xml){
			assert.equal( xml, expected )
		})

	})
})

<commit_msg>adding more explicit assertions around xml deserialization<commit_after>var assert = require("assert")
   ,serializer = require("../lib/serializer")

describe('serializer#xml', function(){
	var doc = [
    '<?xml version="1.0" encoding="UTF-8"?>',
	'<response>',
	' <key type="string">value</key>',
	' <foo type="object">',
	'  <alt type="object">',
	'   <test type="number">1</test>',
	'  </alt>',
	' </foo>',
	' </response>'
	].join('\n')

	it("should do some things 1", function(){
		var s = new serializer({
			defaultFormat:"application/xml"
		});
		s.deserialize(doc, 'text/xml', function( err, content){
			assert.ok( content );
			assert.equal( content.key, 'value')
			assert.equal( content.foo.alt.test, 1 )
		})
	})

	it('should do other things 2', function(){
		var expected = '<?xml version="1.0" encoding="UTF-8"?>\n<response>\n <key type="string">value</key>\n <foo type="object">\n  <alt type="object">\n   <test type="number">1</test>\n  </alt>\n </foo>\n</response>\n'
		var s = new serializer({
			xmlattr:true
		})
		s.serialize({key:'value', foo:{alt:{test:1}}}, 'text/xml', function(e,xml){
			assert.equal( xml, expected )
		})

	})
})


{'fraction_non_alphanumeric': 0.23803009575923392, 'fraction_numerical': 0.010487916096671226, 'mean_word_length': 4.1745283018867925, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 4, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 19}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3073633', 'n_tokens_mistral': 832, 'n_tokens_neox': 788, 'n_words': 164}