Skip to content

Commit

Permalink
Merge pull request #562 from neerdoc/UTF-8
Browse files Browse the repository at this point in the history
UTF-8 specific test files.
  • Loading branch information
neerdoc committed Mar 9, 2022
2 parents 613df32 + 73c1b4c commit c3e6809
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
active: true
derived: false
header: |
UTF-8
level: 1.7.0
links: []
normative: true
ref: ''
reviewed: null
text: |
UTF-8 is supported. Verified by this file.
première is first
première is slightly different
Кириллица is Cyrillic
𐐀 am Deseret
19 changes: 19 additions & 0 deletions doorstop/core/tests/test_fixtures/002-utf8-characters/REQ-MIT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
active: true
derived: false
header: |
MIT licence
level: 1.7.1
links: []
normative: true
ref: ''
reviewed: null
text: |
Just verify that the MIT licence is typeset correctly.
Copyright © 2022 <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 28 additions & 0 deletions doorstop/core/tests/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,3 +1050,31 @@ def test_attributes_with_spec(self, mock_warning):
def test_stamp(self):
"""Verify an unknown item has no stamp."""
self.assertEqual(Stamp(None), self.item.stamp())


class TestUTF8(unittest.TestCase):
"""Unit tests for reading UTF8 formatted files."""

def test_load_cyrillic(self):
"""Verify that cyrillic and other UTF-8 characters are correltly loaded and written."""
ITEM = "doorstop/core/tests/test_fixtures/002-utf8-characters/REQ-CYRILLIC.yml"
backup = common.read_text(ITEM)
item = Item(None, ITEM)
item.load()
item.save()
text = common.read_text(ITEM)
self.maxDiff = None
common.write_text(backup, ITEM)
self.assertEqual(backup, text)

def test_load_mit(self):
"""Verify that an MIT licence is correltly loaded and written."""
ITEM = "doorstop/core/tests/test_fixtures/002-utf8-characters/REQ-MIT.yml"
backup = common.read_text(ITEM)
item = Item(None, ITEM)
item.load()
item.save()
text = common.read_text(ITEM)
self.maxDiff = None
common.write_text(backup, ITEM)
self.assertEqual(backup, text)

0 comments on commit c3e6809

Please sign in to comment.