code: def test_b64decode_invalid_chars(self):
      # issue 1466065: Test some invalid characters.
      tests = (
          (b"%3d==", b"\xdd"),
          (b"$3d==", b"\xdd"),
          (b"[==", b""),
          (b"YW]3=", b"am"),
          (b"3{d==", b"\xdd"),
          (b"3d}==", b"\xdd"),
          (b"@@", b""),
          (b"!", b""),
          (b"YWJj\n", b"abc"),
          (b"YWJj\nYWI=", b"abcab"),
      )
      funcs = (
          base64.b64decode,
          base64.standard_b64decode,
          base64.urlsafe_b64decode,
      )
      for bstr, res in tests:
          for func in funcs:
              with self.subTest(bstr=bstr, func=func):
                  self.assertEqual(func(bstr), res)
                  self.assertEqual(func(bstr.decode("ascii")), res)
          with self.assertRaises(binascii.Error):
              base64.b64decode(bstr, validate=True)
          with self.assertRaises(binascii.Error):
              base64.b64decode(bstr.decode("ascii"), validate=True)
  
      # Normal alphabet characters not discarded when alternative given
      res = b"\xFB\xEF\xBE\xFF\xFF\xFF"
      self.assertEqual(base64.b64decode(b"++[[//]]", b"[]"), res)
      self.assertEqual(base64.urlsafe_b64decode(b"++--//__"), res)
  
imports: import unittest
  import base64
  import binascii
  import os
  from array import array
  from test.support import os_helper
  from test.support import script_helper
label_desc: Use image node_id 9 for calling the BaseXYTestCase obj's underlying member method code with example usage: obj.test_b64decode_invalid_chars() without return types