def test_create_array(self): serializer = Serializer() array = Array(array=[1, 2, 3]) expected_xml = normalise_xml(self.SINGLE_ARRAY) actual = serializer.serialize(array) actual_xml = normalise_xml(ET.tostring(actual)) assert_xml_diff(actual_xml, expected_xml) array.array = [4, 5, 6] expected_xml = normalise_xml(self.SINGLE_ARRAY2) actual = serializer.serialize(array) actual_xml = normalise_xml(ET.tostring(actual)) assert_xml_diff(actual_xml, expected_xml)
def test_two_dimensional_create_array(self): serializer = Serializer() array = Array(array=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]) expected_xml = normalise_xml(self.TWO_ARRAY) actual = serializer.serialize(array) actual_xml = normalise_xml(ET.tostring(actual)) assert_xml_diff(actual_xml, expected_xml)
def test_three_dimensional_create_array(self): serializer = Serializer() array = Array( array=[[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]]]) expected_xml = normalise_xml(self.THREE_ARRAY) actual = serializer.serialize(array) actual_xml = normalise_xml(ET.tostring(actual)) assert expected_xml == actual_xml