Revision 92ea69bf test/ganeti.utils.text_unittest.py
b/test/ganeti.utils.text_unittest.py | ||
---|---|---|
438 | 438 |
self.assertEqual(utils.BuildShellCmd("ls %s", "ab"), "ls ab") |
439 | 439 |
|
440 | 440 |
|
441 |
class TestOrdinal(unittest.TestCase): |
|
442 |
def test(self): |
|
443 |
checks = { |
|
444 |
0: "0th", 1: "1st", 2: "2nd", 3: "3rd", 4: "4th", 5: "5th", 6: "6th", |
|
445 |
7: "7th", 8: "8th", 9: "9th", 10: "10th", 11: "11th", 12: "12th", |
|
446 |
13: "13th", 14: "14th", 15: "15th", 16: "16th", 17: "17th", |
|
447 |
18: "18th", 19: "19th", 20: "20th", 21: "21st", 25: "25th", 30: "30th", |
|
448 |
32: "32nd", 40: "40th", 50: "50th", 55: "55th", 60: "60th", 62: "62nd", |
|
449 |
70: "70th", 80: "80th", 83: "83rd", 90: "90th", 91: "91st", |
|
450 |
582: "582nd", 999: "999th", |
|
451 |
} |
|
452 |
|
|
453 |
for value, ordinal in checks.items(): |
|
454 |
self.assertEqual(utils.FormatOrdinal(value), ordinal) |
|
455 |
|
|
456 |
|
|
441 | 457 |
if __name__ == "__main__": |
442 | 458 |
testutils.GanetiTestProgram() |
Also available in: Unified diff