Revision: 3404
Author: pekka.klarck
Date: Mon May 24 02:27:53 2010
Log: handle prefixes correctly
http://code.google.com/p/robotframework/source/detail?r=3404

Modified:
 /trunk/src/robot/parsing/model.py
 /trunk/utest/parsing/test_model.py

=======================================
--- /trunk/src/robot/parsing/model.py   Sun May 23 22:30:11 2010
+++ /trunk/src/robot/parsing/model.py   Mon May 24 02:27:53 2010
@@ -42,7 +42,7 @@
         if not self.source:
             return None
         name = os.path.splitext(os.path.basename(self.source))[0]
-        name = name.split('__')[-1] # Strip ignored prefix
+        name = name.split('__', 1)[-1]  # Strip possible prefix
         name = name.replace('_', ' ').strip()
         return name.title() if name.islower() else name

=======================================
--- /trunk/utest/parsing/test_model.py  Sun May 23 23:55:29 2010
+++ /trunk/utest/parsing/test_model.py  Mon May 24 02:27:53 2010
@@ -28,8 +28,9 @@
                              ('hello_world.tsv', 'Hello World'),
                              ('HELLO_world.htm', 'HELLO world'),
(' h i w o r l d .htm', 'H I W O R L D'),
+                             ('HelloWorld.txt', 'HelloWorld'),
                              ('09__h_E_l_l_o_', 'h E l l o'),
-                             ('HelloWorld.txt', 'HelloWorld')]:
+                             ('prefix__the__name', 'The  Name')]:
             self.tcf.source = os.path.abspath(source)
             assert_equal(self.tcf.name, name)

Reply via email to