[Bf-blender-cvs] [bdb5a506824] blender-v3.2-release: Update tests to account for Text.as_string not adding a trailing newline
Campbell Barton
noreply at git.blender.org
Tue May 17 10:12:22 CEST 2022
Commit: bdb5a506824f7d173be41f4f6cae113213072243
Author: Campbell Barton
Date: Tue May 17 18:08:52 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rBbdb5a506824f7d173be41f4f6cae113213072243
Update tests to account for Text.as_string not adding a trailing newline
Regression in tests from [0] tests were written to assume a newline was
added to the result of Text.as_string which is no longer the case.
[0]: f4ff36431ccfac2f0a99fc23c18fe0d9de38b36d
===================================================================
M tests/python/bl_pyapi_text.py
===================================================================
diff --git a/tests/python/bl_pyapi_text.py b/tests/python/bl_pyapi_text.py
index 0d8987fb69d..95b83f54772 100644
--- a/tests/python/bl_pyapi_text.py
+++ b/tests/python/bl_pyapi_text.py
@@ -17,11 +17,11 @@ class TestText(unittest.TestCase):
def test_text_new(self):
self.assertEqual(len(bpy.data.texts), 1)
self.assertEqual(self.text.name, "test_text")
- self.assertEqual(self.text.as_string(), "\n")
+ self.assertEqual(self.text.as_string(), "")
def test_text_clear(self):
self.text.clear()
- self.assertEqual(self.text.as_string(), "\n")
+ self.assertEqual(self.text.as_string(), "")
def test_text_fill(self):
tmp_text = (
@@ -30,7 +30,7 @@ class TestText(unittest.TestCase):
"Line 3: test line 3"
)
self.text.write(tmp_text)
- self.assertEqual(self.text.as_string(), tmp_text + "\n")
+ self.assertEqual(self.text.as_string(), tmp_text)
def test_text_region_as_string(self):
tmp_text = (
@@ -53,10 +53,10 @@ class TestText(unittest.TestCase):
self.text.write(tmp_text)
# Set string in the middle of the text.
self.text.region_from_string("line 2", range=((1, 0), (1, -1)))
- self.assertEqual(self.text.as_string(), tmp_text.replace("Line 2: test line 2", "line 2") + "\n")
+ self.assertEqual(self.text.as_string(), tmp_text.replace("Line 2: test line 2", "line 2"))
# Large range test.
self.text.region_from_string("New Text", range=((-10000, -10000), (10000, 10000)))
- self.assertEqual(self.text.as_string(), "New Text\n")
+ self.assertEqual(self.text.as_string(), "New Text")
if __name__ == "__main__":
More information about the Bf-blender-cvs
mailing list