Changeset 57be490 in sasview for src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
- Timestamp:
- May 17, 2018 4:50:09 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 085e3c9d
- Parents:
- 976978b
- git-author:
- Piotr Rozyczko <rozyczko@…> (04/13/18 09:34:43)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (05/17/18 04:50:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r6cb305a r57be490 1 # -*- coding: utf-8 -*- 1 2 import sys 2 3 import unittest … … 446 447 self.assertEqual(yscale, "log") 447 448 449 def testReplaceHTMLwithUTF8(self): 450 ''' test single character replacement ''' 451 s = None 452 with self.assertRaises(AttributeError): 453 result = replaceHTMLwithUTF8(s) 454 455 s = "" 456 self.assertEqual(replaceHTMLwithUTF8(s), s) 457 458 s = "aaaa" 459 self.assertEqual(replaceHTMLwithUTF8(s), s) 460 461 s = "Å ∞ ±" 462 self.assertEqual(replaceHTMLwithUTF8(s), "à 463 â ±") 464 465 def testReplaceHTMLwithASCII(self): 466 ''' test single character replacement''' 467 s = None 468 with self.assertRaises(AttributeError): 469 result = replaceHTMLwithASCII(s) 470 471 s = "" 472 self.assertEqual(replaceHTMLwithASCII(s), s) 473 474 s = "aaaa" 475 self.assertEqual(replaceHTMLwithASCII(s), s) 476 477 s = "Å ∞ ±" 478 self.assertEqual(replaceHTMLwithASCII(s), "Ang inf +/-") 479 480 def testConvertUnitToUTF8(self): 481 ''' test unit string replacement''' 482 s = None 483 self.assertIsNone(convertUnitToUTF8(s)) 484 485 s = "" 486 self.assertEqual(convertUnitToUTF8(s), s) 487 488 s = "aaaa" 489 self.assertEqual(convertUnitToUTF8(s), s) 490 491 s = "1/A" 492 self.assertEqual(convertUnitToUTF8(s), "à 493 <sup>-1</sup>") 494 495 s = "Ang" 496 self.assertEqual(convertUnitToUTF8(s), "à 497 ") 498 499 s = "1e-6/Ang^2" 500 self.assertEqual(convertUnitToUTF8(s), "10<sup>-6</sup>/à 501 <sup>2</sup>") 502 503 s = "inf" 504 self.assertEqual(convertUnitToUTF8(s), "â") 505 506 s = "1/cm" 507 self.assertEqual(convertUnitToUTF8(s), "cm<sup>-1</sup>") 508 509 def testConvertUnitToHTML(self): 510 ''' test unit string replacement''' 511 s = None 512 self.assertIsNone(convertUnitToHTML(s)) 513 514 s = "" 515 self.assertEqual(convertUnitToHTML(s), s) 516 517 s = "aaaa" 518 self.assertEqual(convertUnitToHTML(s), s) 519 520 s = "1/A" 521 self.assertEqual(convertUnitToHTML(s), "Å<sup>-1</sup>") 522 523 s = "Ang" 524 self.assertEqual(convertUnitToHTML(s), "Å") 525 526 s = "1e-6/Ang^2" 527 self.assertEqual(convertUnitToHTML(s), "10<sup>-6</sup>/Å<sup>2</sup>") 528 529 s = "inf" 530 self.assertEqual(convertUnitToHTML(s), "∞") 531 s = "-inf" 532 533 self.assertEqual(convertUnitToHTML(s), "-∞") 534 535 s = "1/cm" 536 self.assertEqual(convertUnitToHTML(s), "cm<sup>-1</sup>") 537 448 538 def testParseName(self): 449 539 '''test parse out a string from the beinning of a string'''
Note: See TracChangeset
for help on using the changeset viewer.