mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document the
deprecation of imp.get_magic().
This commit is contained in:
parent
4d7056258b
commit
05a647deed
8 changed files with 37 additions and 8 deletions
|
@ -313,5 +313,16 @@ class ResolveNameTests(unittest.TestCase):
|
|||
util.resolve_name('..bacon', 'spam')
|
||||
|
||||
|
||||
class MagicNumberTests(unittest.TestCase):
|
||||
|
||||
def test_length(self):
|
||||
# Should be 4 bytes.
|
||||
self.assertEqual(len(util.MAGIC_NUMBER), 4)
|
||||
|
||||
def test_incorporates_rn(self):
|
||||
# The magic number uses \r\n to come out wrong when splitting on lines.
|
||||
self.assertTrue(util.MAGIC_NUMBER.endswith(b'\r\n'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue