| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -509,6 +509,69 @@ def test_bytes(self): | |
| data2 = plistlib.dumps(pl2) | ||
| self.assertEqual(data, data2) | ||
|
|
||
| def test_bytes_indent(self): | ||
| header = ( | ||
| b'<?xml version="1.0" encoding="UTF-8"?>\n' | ||
| b'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n' | ||
| b'<plist version="1.0">\n') | ||
| data = [{'bytes': bytes(range(50))}] | ||
| pl = plistlib.dumps(data) | ||
| self.assertEqual(pl, header + | ||
| b'<array>\n' | ||
| b'\t<dict>\n' | ||
| b'\t\t<key>bytes</key>\n' | ||
| b'\t\t<data>\n' | ||
| b'\t\tAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKiss\n' | ||
| b'\t\tLS4vMDE=\n' | ||
| b'\t\t</data>\n' | ||
| b'\t</dict>\n' | ||
| b'</array>\n' | ||
| b'</plist>\n') | ||
|
|
||
| def dumps_with_indent(data, indent): | ||
| fp = BytesIO() | ||
| writer = plistlib._PlistWriter(fp, indent=indent) | ||
| writer.write(data) | ||
| return fp.getvalue() | ||
|
|
||
| pl = dumps_with_indent(data, b' ') | ||
| self.assertEqual(pl, header + | ||
| b'<array>\n' | ||
| b' <dict>\n' | ||
| b' <key>bytes</key>\n' | ||
| b' <data>\n' | ||
| b' AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDE=\n' | ||
| b' </data>\n' | ||
| b' </dict>\n' | ||
| b'</array>\n' | ||
| b'</plist>\n') | ||
|
|
||
| pl = dumps_with_indent(data, b' \t') | ||
|
Comment thread
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis catches the original bug.
Sorry, something went wrong.
All reactions
|
||
| self.assertEqual(pl, header + | ||
| b'<array>\n' | ||
| b' \t<dict>\n' | ||
| b' \t \t<key>bytes</key>\n' | ||
| b' \t \t<data>\n' | ||
| b' \t \tAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKiss\n' | ||
| b' \t \tLS4vMDE=\n' | ||
| b' \t \t</data>\n' | ||
| b' \t</dict>\n' | ||
| b'</array>\n' | ||
| b'</plist>\n') | ||
|
|
||
| pl = dumps_with_indent(data, b'\t ') | ||
|
Comment thread
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis catches a bug in my initial fix in #143216.
Sorry, something went wrong.
All reactions
|
||
| self.assertEqual(pl, header + | ||
| b'<array>\n' | ||
| b'\t <dict>\n' | ||
| b'\t \t <key>bytes</key>\n' | ||
| b'\t \t <data>\n' | ||
| b'\t \t AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygp\n' | ||
| b'\t \t KissLS4vMDE=\n' | ||
| b'\t \t </data>\n' | ||
| b'\t </dict>\n' | ||
| b'</array>\n' | ||
| b'</plist>\n') | ||
|
|
||
| def test_loads_str_with_xml_fmt(self): | ||
| pl = self._create() | ||
| b = plistlib.dumps(pl) | ||
| Expand Down Expand Up | @@ -581,7 +644,6 @@ def test_appleformatting(self): | |
| self.assertEqual(data, TESTDATA[fmt], | ||
| "generated data was not identical to Apple's output") | ||
|
|
||
|
|
||
| def test_appleformattingfromliteral(self): | ||
| self.maxDiff = None | ||
| for fmt in ALL_FORMATS: | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Fix incorrect wrapping of the Base64 data in :class:`!plistlib._PlistWriter` | ||
| when the indent contains a mix of tabs and spaces. |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis tests non-default indentation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.