'Check union structs handling.'

def testUnionCast(self):

    tested_non_union = TestStruct()
    self.assertRaises(AttributeError, tested_non_union.UnionCast)
    tested_union = UnionTest()
    self.assertEqual(tested_union.UnionCast(), 5)
    tested_union.struct_flavor = 'FIRST'
    self.assertEqual(tested_union.UnionCast(), 1.1)
    tested_union.struct_flavor = 'SECOND'
    self.assertEqual(tested_union.UnionCast(), 'string')
    tested_union.struct_flavor = 'THIRD'
    self.assertEqual(tested_union.UnionCast(), 5)
    tested_union.third = 1337
    self.assertEqual(tested_union.UnionCast(), 1337)
    tested_union.first = 1.61803399
    self.assertRaises(ValueError, tested_union.UnionCast)
