Best Python code snippet using prospector_python
tests.py
Source:tests.py
...48 default_options.space_around_combinator = false49 default_options.preserve_newlines = false50 default_options.space_around_selector_separator = false51 cls.default_options = default_options52 def reset_options(self):53 self.options = copy.copy(self.default_options)54 def testGenerated(self):55 self.reset_options()56 test_fragment = self.decodesto57 t = self.decodesto58 false = False59 true = True60 #============================================================61 # End With Newline - (eof = "\n")62 self.reset_options();63 self.options.end_with_newline = true64 test_fragment('', '\n')65 test_fragment(' .tabs{}', ' .tabs {}\n')66 test_fragment(67 ' \n' +68 '\n' +69 '.tabs{}\n' +70 '\n' +71 '\n' +72 '\n',73 # -- output --74 ' .tabs {}\n')75 test_fragment('\n')76 # End With Newline - (eof = "")77 self.reset_options();78 self.options.end_with_newline = false79 test_fragment('')80 test_fragment(' .tabs{}', ' .tabs {}')81 test_fragment(82 ' \n' +83 '\n' +84 '.tabs{}\n' +85 '\n' +86 '\n' +87 '\n',88 # -- output --89 ' .tabs {}')90 test_fragment('\n', '')91 #============================================================92 # Empty braces93 self.reset_options();94 t('.tabs{}', '.tabs {}')95 t('.tabs { }', '.tabs {}')96 t('.tabs { }', '.tabs {}')97 t(98 '.tabs \n' +99 '{\n' +100 ' \n' +101 ' }',102 # -- output --103 '.tabs {}')104 #============================================================105 # 106 self.reset_options();107 t(108 '#cboxOverlay {\n' +109 '\tbackground: url(images/overlay.png) repeat 0 0;\n' +110 '\topacity: 0.9;\n' +111 '\tfilter: alpha(opacity = 90);\n' +112 '}',113 # -- output --114 '#cboxOverlay {\n' +115 '\tbackground: url(images/overlay.png) repeat 0 0;\n' +116 '\topacity: 0.9;\n' +117 '\tfilter: alpha(opacity=90);\n' +118 '}')119 #============================================================120 # Support simple language specific option inheritance/overriding - (c = " ")121 self.reset_options();122 self.options.indent_char = ' '123 self.options.indent_size = 4124 self.options.js = { 'indent_size': 3 }125 self.options.css = { 'indent_size': 5 }126 t(127 '.selector {\n' +128 ' font-size: 12px;\n' +129 '}')130 # Support simple language specific option inheritance/overriding - (c = " ")131 self.reset_options();132 self.options.indent_char = ' '133 self.options.indent_size = 4134 self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 5 } }135 t(136 '.selector {\n' +137 ' font-size: 12px;\n' +138 '}')139 # Support simple language specific option inheritance/overriding - (c = " ")140 self.reset_options();141 self.options.indent_char = ' '142 self.options.indent_size = 9143 self.options.html = { 'js': { 'indent_size': 3 }, 'css': { 'indent_size': 8 }, 'indent_size': 2}144 self.options.js = { 'indent_size': 5 }145 self.options.css = { 'indent_size': 3 }146 t(147 '.selector {\n' +148 ' font-size: 12px;\n' +149 '}')150 #============================================================151 # Space Around Combinator - (space = " ")152 self.reset_options();153 self.options.space_around_combinator = true154 t('a>b{}', 'a > b {}')155 t('a~b{}', 'a ~ b {}')156 t('a+b{}', 'a + b {}')157 t('a+b>c{}', 'a + b > c {}')158 t('a > b{}', 'a > b {}')159 t('a ~ b{}', 'a ~ b {}')160 t('a + b{}', 'a + b {}')161 t('a + b > c{}', 'a + b > c {}')162 t(163 'a > b{width: calc(100% + 45px);}',164 # -- output --165 'a > b {\n' +166 '\twidth: calc(100% + 45px);\n' +167 '}')168 t(169 'a ~ b{width: calc(100% + 45px);}',170 # -- output --171 'a ~ b {\n' +172 '\twidth: calc(100% + 45px);\n' +173 '}')174 t(175 'a + b{width: calc(100% + 45px);}',176 # -- output --177 'a + b {\n' +178 '\twidth: calc(100% + 45px);\n' +179 '}')180 t(181 'a + b > c{width: calc(100% + 45px);}',182 # -- output --183 'a + b > c {\n' +184 '\twidth: calc(100% + 45px);\n' +185 '}')186 # Space Around Combinator - (space = "")187 self.reset_options();188 self.options.space_around_combinator = false189 t('a>b{}', 'a>b {}')190 t('a~b{}', 'a~b {}')191 t('a+b{}', 'a+b {}')192 t('a+b>c{}', 'a+b>c {}')193 t('a > b{}', 'a>b {}')194 t('a ~ b{}', 'a~b {}')195 t('a + b{}', 'a+b {}')196 t('a + b > c{}', 'a+b>c {}')197 t(198 'a > b{width: calc(100% + 45px);}',199 # -- output --200 'a>b {\n' +201 '\twidth: calc(100% + 45px);\n' +202 '}')203 t(204 'a ~ b{width: calc(100% + 45px);}',205 # -- output --206 'a~b {\n' +207 '\twidth: calc(100% + 45px);\n' +208 '}')209 t(210 'a + b{width: calc(100% + 45px);}',211 # -- output --212 'a+b {\n' +213 '\twidth: calc(100% + 45px);\n' +214 '}')215 t(216 'a + b > c{width: calc(100% + 45px);}',217 # -- output --218 'a+b>c {\n' +219 '\twidth: calc(100% + 45px);\n' +220 '}')221 # Space Around Combinator - (space = " ")222 self.reset_options();223 self.options.space_around_selector_separator = true224 t('a>b{}', 'a > b {}')225 t('a~b{}', 'a ~ b {}')226 t('a+b{}', 'a + b {}')227 t('a+b>c{}', 'a + b > c {}')228 t('a > b{}', 'a > b {}')229 t('a ~ b{}', 'a ~ b {}')230 t('a + b{}', 'a + b {}')231 t('a + b > c{}', 'a + b > c {}')232 t(233 'a > b{width: calc(100% + 45px);}',234 # -- output --235 'a > b {\n' +236 '\twidth: calc(100% + 45px);\n' +237 '}')238 t(239 'a ~ b{width: calc(100% + 45px);}',240 # -- output --241 'a ~ b {\n' +242 '\twidth: calc(100% + 45px);\n' +243 '}')244 t(245 'a + b{width: calc(100% + 45px);}',246 # -- output --247 'a + b {\n' +248 '\twidth: calc(100% + 45px);\n' +249 '}')250 t(251 'a + b > c{width: calc(100% + 45px);}',252 # -- output --253 'a + b > c {\n' +254 '\twidth: calc(100% + 45px);\n' +255 '}')256 #============================================================257 # Selector Separator - (separator = " ", separator1 = " ")258 self.reset_options();259 self.options.selector_separator_newline = false260 self.options.selector_separator = " "261 t(262 '#bla, #foo{color:green}',263 # -- output --264 '#bla, #foo {\n' +265 '\tcolor: green\n' +266 '}')267 t(268 '@media print {.tab{}}',269 # -- output --270 '@media print {\n' +271 '\t.tab {}\n' +272 '}')273 t(274 '@media print {.tab,.bat{}}',275 # -- output --276 '@media print {\n' +277 '\t.tab, .bat {}\n' +278 '}')279 t(280 '#bla, #foo{color:black}',281 # -- output --282 '#bla, #foo {\n' +283 '\tcolor: black\n' +284 '}')285 t(286 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',287 # -- output --288 'a:first-child, a:first-child {\n' +289 '\tcolor: red;\n' +290 '\tdiv:first-child, div:hover {\n' +291 '\t\tcolor: black;\n' +292 '\t}\n' +293 '}')294 # Selector Separator - (separator = " ", separator1 = " ")295 self.reset_options();296 self.options.selector_separator_newline = false297 self.options.selector_separator = " "298 t(299 '#bla, #foo{color:green}',300 # -- output --301 '#bla, #foo {\n' +302 '\tcolor: green\n' +303 '}')304 t(305 '@media print {.tab{}}',306 # -- output --307 '@media print {\n' +308 '\t.tab {}\n' +309 '}')310 t(311 '@media print {.tab,.bat{}}',312 # -- output --313 '@media print {\n' +314 '\t.tab, .bat {}\n' +315 '}')316 t(317 '#bla, #foo{color:black}',318 # -- output --319 '#bla, #foo {\n' +320 '\tcolor: black\n' +321 '}')322 t(323 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',324 # -- output --325 'a:first-child, a:first-child {\n' +326 '\tcolor: red;\n' +327 '\tdiv:first-child, div:hover {\n' +328 '\t\tcolor: black;\n' +329 '\t}\n' +330 '}')331 # Selector Separator - (separator = "\n", separator1 = "\n\t")332 self.reset_options();333 self.options.selector_separator_newline = true334 self.options.selector_separator = " "335 t(336 '#bla, #foo{color:green}',337 # -- output --338 '#bla,\n#foo {\n' +339 '\tcolor: green\n' +340 '}')341 t(342 '@media print {.tab{}}',343 # -- output --344 '@media print {\n' +345 '\t.tab {}\n' +346 '}')347 t(348 '@media print {.tab,.bat{}}',349 # -- output --350 '@media print {\n' +351 '\t.tab,\n\t.bat {}\n' +352 '}')353 t(354 '#bla, #foo{color:black}',355 # -- output --356 '#bla,\n#foo {\n' +357 '\tcolor: black\n' +358 '}')359 t(360 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',361 # -- output --362 'a:first-child,\na:first-child {\n' +363 '\tcolor: red;\n' +364 '\tdiv:first-child,\n\tdiv:hover {\n' +365 '\t\tcolor: black;\n' +366 '\t}\n' +367 '}')368 # Selector Separator - (separator = "\n", separator1 = "\n\t")369 self.reset_options();370 self.options.selector_separator_newline = true371 self.options.selector_separator = " "372 t(373 '#bla, #foo{color:green}',374 # -- output --375 '#bla,\n#foo {\n' +376 '\tcolor: green\n' +377 '}')378 t(379 '@media print {.tab{}}',380 # -- output --381 '@media print {\n' +382 '\t.tab {}\n' +383 '}')384 t(385 '@media print {.tab,.bat{}}',386 # -- output --387 '@media print {\n' +388 '\t.tab,\n\t.bat {}\n' +389 '}')390 t(391 '#bla, #foo{color:black}',392 # -- output --393 '#bla,\n#foo {\n' +394 '\tcolor: black\n' +395 '}')396 t(397 'a:first-child,a:first-child{color:red;div:first-child,div:hover{color:black;}}',398 # -- output --399 'a:first-child,\na:first-child {\n' +400 '\tcolor: red;\n' +401 '\tdiv:first-child,\n\tdiv:hover {\n' +402 '\t\tcolor: black;\n' +403 '\t}\n' +404 '}')405 #============================================================406 # Preserve Newlines - (separator_input = "\n\n", separator_output = "\n\n")407 self.reset_options();408 self.options.preserve_newlines = true409 t('.div {}\n\n.span {}')410 t(411 '#bla, #foo{\n' +412 '\tcolor:black;\n\n\tfont-size: 12px;\n' +413 '}',414 # -- output --415 '#bla,\n' +416 '#foo {\n' +417 '\tcolor: black;\n\n\tfont-size: 12px;\n' +418 '}')419 # Preserve Newlines - (separator_input = "\n\n", separator_output = "\n")420 self.reset_options();421 self.options.preserve_newlines = false422 t('.div {}\n\n.span {}', '.div {}\n.span {}')423 t(424 '#bla, #foo{\n' +425 '\tcolor:black;\n\n\tfont-size: 12px;\n' +426 '}',427 # -- output --428 '#bla,\n' +429 '#foo {\n' +430 '\tcolor: black;\n\tfont-size: 12px;\n' +431 '}')432 #============================================================433 # Preserve Newlines and newline_between_rules434 self.reset_options();435 self.options.preserve_newlines = true436 self.options.newline_between_rules = true437 t(438 '.div {}.span {}',439 # -- output --440 '.div {}\n' +441 '\n' +442 '.span {}')443 t(444 '#bla, #foo{\n' +445 '\tcolor:black;\n' +446 '\tfont-size: 12px;\n' +447 '}',448 # -- output --449 '#bla,\n' +450 '#foo {\n' +451 '\tcolor: black;\n' +452 '\tfont-size: 12px;\n' +453 '}')454 t(455 '#bla, #foo{\n' +456 '\tcolor:black;\n' +457 '\n' +458 '\n' +459 '\tfont-size: 12px;\n' +460 '}',461 # -- output --462 '#bla,\n' +463 '#foo {\n' +464 '\tcolor: black;\n' +465 '\n' +466 '\n' +467 '\tfont-size: 12px;\n' +468 '}')469 t(470 '#bla,\n' +471 '\n' +472 '#foo {\n' +473 '\tcolor: black;\n' +474 '\tfont-size: 12px;\n' +475 '}')476 t(477 'a {\n' +478 '\tb: c;\n' +479 '\n' +480 '\n' +481 '\td: {\n' +482 '\t\te: f;\n' +483 '\t}\n' +484 '}')485 t(486 '.div {}\n' +487 '\n' +488 '.span {}')489 t(490 'html {}\n' +491 '\n' +492 '/*this is a comment*/')493 t(494 '.div {\n' +495 '\ta: 1;\n' +496 '\n' +497 '\n' +498 '\tb: 2;\n' +499 '}\n' +500 '\n' +501 '\n' +502 '\n' +503 '.span {\n' +504 '\ta: 1;\n' +505 '}')506 t(507 '.div {\n' +508 '\n' +509 '\n' +510 '\ta: 1;\n' +511 '\n' +512 '\n' +513 '\tb: 2;\n' +514 '}\n' +515 '\n' +516 '\n' +517 '\n' +518 '.span {\n' +519 '\ta: 1;\n' +520 '}')521 t(522 '@media screen {\n' +523 '\t.div {\n' +524 '\t\ta: 1;\n' +525 '\n' +526 '\n' +527 '\t\tb: 2;\n' +528 '\t}\n' +529 '\n' +530 '\n' +531 '\n' +532 '\t.span {\n' +533 '\t\ta: 1;\n' +534 '\t}\n' +535 '}\n' +536 '\n' +537 '.div {}\n' +538 '\n' +539 '.span {}')540 #============================================================541 # Preserve Newlines and add tabs542 self.reset_options();543 self.options.preserve_newlines = true544 t(545 '.tool-tip {\n' +546 '\tposition: relative;\n' +547 '\n' +548 '\t\t\n' +549 '\t.tool-tip-content {\n' +550 '\t\t&>* {\n' +551 '\t\t\tmargin-top: 0;\n' +552 '\t\t}\n' +553 '\t\t\n' +554 '\n' +555 '\t\t.mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n' +556 '\t\tpadding: 1rem;\n' +557 '\t\tposition: absolute;\n' +558 '\t\tz-index: 10;\n' +559 '\t}\n' +560 '}',561 # -- output --562 '.tool-tip {\n' +563 '\tposition: relative;\n' +564 '\n' +565 '\n' +566 '\t.tool-tip-content {\n' +567 '\t\t&>* {\n' +568 '\t\t\tmargin-top: 0;\n' +569 '\t\t}\n' +570 '\n\n\t\t.mixin-box-shadow(.2rem .2rem .5rem rgba(0, 0, 0, .15));\n' +571 '\t\tpadding: 1rem;\n' +572 '\t\tposition: absolute;\n' +573 '\t\tz-index: 10;\n' +574 '\t}\n' +575 '}')576 #============================================================577 # Newline Between Rules - (separator = "\n")578 self.reset_options();579 self.options.newline_between_rules = true580 t(581 '.div {}\n' +582 '.span {}',583 # -- output --584 '.div {}\n' +585 '\n.span {}')586 t(587 '.div{}\n' +588 ' \n' +589 '.span{}',590 # -- output --591 '.div {}\n' +592 '\n.span {}')593 t(594 '.div {} \n' +595 ' \n' +596 '.span { } \n',597 # -- output --598 '.div {}\n' +599 '\n.span {}')600 t(601 '.div {\n' +602 ' \n' +603 '} \n' +604 ' .span {\n' +605 ' } ',606 # -- output --607 '.div {}\n' +608 '\n.span {}')609 t(610 '.selector1 {\n' +611 '\tmargin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +612 '}\n' +613 '.div{height:15px;}',614 # -- output --615 '.selector1 {\n' +616 '\tmargin: 0;\n' +617 '\t/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +618 '}\n' +619 '\n.div {\n' +620 '\theight: 15px;\n' +621 '}')622 t(623 '.tabs{width:10px;//end of line comment\n' +624 'height:10px;//another\n' +625 '}\n' +626 '.div{height:15px;}',627 # -- output --628 '.tabs {\n' +629 '\twidth: 10px; //end of line comment\n' +630 '\theight: 10px; //another\n' +631 '}\n' +632 '\n.div {\n' +633 '\theight: 15px;\n' +634 '}')635 t(636 '#foo {\n' +637 '\tbackground-image: url(foo@2x.png);\n' +638 '\t@font-face {\n' +639 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +640 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +641 '\t}\n' +642 '}\n' +643 '.div{height:15px;}',644 # -- output --645 '#foo {\n' +646 '\tbackground-image: url(foo@2x.png);\n' +647 '\t@font-face {\n' +648 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +649 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +650 '\t}\n' +651 '}\n' +652 '\n.div {\n' +653 '\theight: 15px;\n' +654 '}')655 t(656 '@media screen {\n' +657 '\t#foo:hover {\n' +658 '\t\tbackground-image: url(foo@2x.png);\n' +659 '\t}\n' +660 '\t@font-face {\n' +661 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +662 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +663 '\t}\n' +664 '}\n' +665 '.div{height:15px;}',666 # -- output --667 '@media screen {\n' +668 '\t#foo:hover {\n' +669 '\t\tbackground-image: url(foo@2x.png);\n' +670 '\t}\n' +671 '\t@font-face {\n' +672 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +673 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +674 '\t}\n' +675 '}\n' +676 '\n.div {\n' +677 '\theight: 15px;\n' +678 '}')679 t(680 '@font-face {\n' +681 '\tfont-family: "Bitstream Vera Serif Bold";\n' +682 '\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +683 '}\n' +684 '@media screen {\n' +685 '\t#foo:hover {\n' +686 '\t\tbackground-image: url(foo.png);\n' +687 '\t}\n' +688 '\t@media screen and (min-device-pixel-ratio: 2) {\n' +689 '\t\t@font-face {\n' +690 '\t\t\tfont-family: "Helvetica Neue"\n' +691 '\t\t}\n' +692 '\t\t#foo:hover {\n' +693 '\t\t\tbackground-image: url(foo@2x.png);\n' +694 '\t\t}\n' +695 '\t}\n' +696 '}',697 # -- output --698 '@font-face {\n' +699 '\tfont-family: "Bitstream Vera Serif Bold";\n' +700 '\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +701 '}\n' +702 '\n@media screen {\n' +703 '\t#foo:hover {\n' +704 '\t\tbackground-image: url(foo.png);\n' +705 '\t}\n' +706 '\t@media screen and (min-device-pixel-ratio: 2) {\n' +707 '\t\t@font-face {\n' +708 '\t\t\tfont-family: "Helvetica Neue"\n' +709 '\t\t}\n' +710 '\t\t#foo:hover {\n' +711 '\t\t\tbackground-image: url(foo@2x.png);\n' +712 '\t\t}\n' +713 '\t}\n' +714 '}')715 t(716 'a:first-child{color:red;div:first-child{color:black;}}\n' +717 '.div{height:15px;}',718 # -- output --719 'a:first-child {\n' +720 '\tcolor: red;\n' +721 '\tdiv:first-child {\n' +722 '\t\tcolor: black;\n' +723 '\t}\n' +724 '}\n' +725 '\n.div {\n' +726 '\theight: 15px;\n' +727 '}')728 t(729 'a:first-child{color:red;div:not(.peq){color:black;}}\n' +730 '.div{height:15px;}',731 # -- output --732 'a:first-child {\n' +733 '\tcolor: red;\n' +734 '\tdiv:not(.peq) {\n' +735 '\t\tcolor: black;\n' +736 '\t}\n' +737 '}\n' +738 '\n.div {\n' +739 '\theight: 15px;\n' +740 '}')741 # Newline Between Rules - (separator = "")742 self.reset_options();743 self.options.newline_between_rules = false744 t(745 '.div {}\n' +746 '.span {}')747 t(748 '.div{}\n' +749 ' \n' +750 '.span{}',751 # -- output --752 '.div {}\n' +753 '.span {}')754 t(755 '.div {} \n' +756 ' \n' +757 '.span { } \n',758 # -- output --759 '.div {}\n' +760 '.span {}')761 t(762 '.div {\n' +763 ' \n' +764 '} \n' +765 ' .span {\n' +766 ' } ',767 # -- output --768 '.div {}\n' +769 '.span {}')770 t(771 '.selector1 {\n' +772 '\tmargin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +773 '}\n' +774 '.div{height:15px;}',775 # -- output --776 '.selector1 {\n' +777 '\tmargin: 0;\n' +778 '\t/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +779 '}\n' +780 '.div {\n' +781 '\theight: 15px;\n' +782 '}')783 t(784 '.tabs{width:10px;//end of line comment\n' +785 'height:10px;//another\n' +786 '}\n' +787 '.div{height:15px;}',788 # -- output --789 '.tabs {\n' +790 '\twidth: 10px; //end of line comment\n' +791 '\theight: 10px; //another\n' +792 '}\n' +793 '.div {\n' +794 '\theight: 15px;\n' +795 '}')796 t(797 '#foo {\n' +798 '\tbackground-image: url(foo@2x.png);\n' +799 '\t@font-face {\n' +800 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +801 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +802 '\t}\n' +803 '}\n' +804 '.div{height:15px;}',805 # -- output --806 '#foo {\n' +807 '\tbackground-image: url(foo@2x.png);\n' +808 '\t@font-face {\n' +809 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +810 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +811 '\t}\n' +812 '}\n' +813 '.div {\n' +814 '\theight: 15px;\n' +815 '}')816 t(817 '@media screen {\n' +818 '\t#foo:hover {\n' +819 '\t\tbackground-image: url(foo@2x.png);\n' +820 '\t}\n' +821 '\t@font-face {\n' +822 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +823 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +824 '\t}\n' +825 '}\n' +826 '.div{height:15px;}',827 # -- output --828 '@media screen {\n' +829 '\t#foo:hover {\n' +830 '\t\tbackground-image: url(foo@2x.png);\n' +831 '\t}\n' +832 '\t@font-face {\n' +833 '\t\tfont-family: "Bitstream Vera Serif Bold";\n' +834 '\t\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +835 '\t}\n' +836 '}\n' +837 '.div {\n' +838 '\theight: 15px;\n' +839 '}')840 t(841 '@font-face {\n' +842 '\tfont-family: "Bitstream Vera Serif Bold";\n' +843 '\tsrc: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");\n' +844 '}\n' +845 '@media screen {\n' +846 '\t#foo:hover {\n' +847 '\t\tbackground-image: url(foo.png);\n' +848 '\t}\n' +849 '\t@media screen and (min-device-pixel-ratio: 2) {\n' +850 '\t\t@font-face {\n' +851 '\t\t\tfont-family: "Helvetica Neue"\n' +852 '\t\t}\n' +853 '\t\t#foo:hover {\n' +854 '\t\t\tbackground-image: url(foo@2x.png);\n' +855 '\t\t}\n' +856 '\t}\n' +857 '}')858 t(859 'a:first-child{color:red;div:first-child{color:black;}}\n' +860 '.div{height:15px;}',861 # -- output --862 'a:first-child {\n' +863 '\tcolor: red;\n' +864 '\tdiv:first-child {\n' +865 '\t\tcolor: black;\n' +866 '\t}\n' +867 '}\n' +868 '.div {\n' +869 '\theight: 15px;\n' +870 '}')871 t(872 'a:first-child{color:red;div:not(.peq){color:black;}}\n' +873 '.div{height:15px;}',874 # -- output --875 'a:first-child {\n' +876 '\tcolor: red;\n' +877 '\tdiv:not(.peq) {\n' +878 '\t\tcolor: black;\n' +879 '\t}\n' +880 '}\n' +881 '.div {\n' +882 '\theight: 15px;\n' +883 '}')884 #============================================================885 # Functions braces886 self.reset_options();887 t('.tabs(){}', '.tabs() {}')888 t('.tabs (){}', '.tabs () {}')889 t(890 '.tabs (pa, pa(1,2)), .cols { }',891 # -- output --892 '.tabs (pa, pa(1, 2)),\n' +893 '.cols {}')894 t(895 '.tabs(pa, pa(1,2)), .cols { }',896 # -- output --897 '.tabs(pa, pa(1, 2)),\n' +898 '.cols {}')899 t('.tabs ( ) { }', '.tabs () {}')900 t('.tabs( ) { }', '.tabs() {}')901 t(902 '.tabs (t, t2) \n' +903 '{\n' +904 ' key: val(p1 ,p2); \n' +905 ' }',906 # -- output --907 '.tabs (t, t2) {\n' +908 '\tkey: val(p1, p2);\n' +909 '}')910 t(911 '.box-shadow(@shadow: 0 1px 3px rgba(0, 0, 0, .25)) {\n' +912 '\t-webkit-box-shadow: @shadow;\n' +913 '\t-moz-box-shadow: @shadow;\n' +914 '\tbox-shadow: @shadow;\n' +915 '}')916 #============================================================917 # Comments918 self.reset_options();919 t('/* test */')920 t(921 '.tabs{/* test */}',922 # -- output --923 '.tabs {\n' +924 '\t/* test */\n' +925 '}')926 t(927 '.tabs{/* test */}',928 # -- output --929 '.tabs {\n' +930 '\t/* test */\n' +931 '}')932 t(933 '/* header */.tabs {}',934 # -- output --935 '/* header */\n' +936 '\n' +937 '.tabs {}')938 t(939 '.tabs {\n' +940 '/* non-header */\n' +941 'width:10px;}',942 # -- output --943 '.tabs {\n' +944 '\t/* non-header */\n' +945 '\twidth: 10px;\n' +946 '}')947 t('/* header')948 t('// comment')949 t(950 '.selector1 {\n' +951 '\tmargin: 0; /* This is a comment including an url http://domain.com/path/to/file.ext */\n' +952 '}',953 # -- output --954 '.selector1 {\n' +955 '\tmargin: 0;\n' +956 '\t/* This is a comment including an url http://domain.com/path/to/file.ext */\n' +957 '}')958 959 # single line comment support (less/sass)960 t(961 '.tabs{\n' +962 '// comment\n' +963 'width:10px;\n' +964 '}',965 # -- output --966 '.tabs {\n' +967 '\t// comment\n' +968 '\twidth: 10px;\n' +969 '}')970 t(971 '.tabs{// comment\n' +972 'width:10px;\n' +973 '}',974 # -- output --975 '.tabs {\n' +976 '\t// comment\n' +977 '\twidth: 10px;\n' +978 '}')979 t(980 '//comment\n' +981 '.tabs{width:10px;}',982 # -- output --983 '//comment\n' +984 '.tabs {\n' +985 '\twidth: 10px;\n' +986 '}')987 t(988 '.tabs{//comment\n' +989 '//2nd single line comment\n' +990 'width:10px;}',991 # -- output --992 '.tabs {\n' +993 '\t//comment\n' +994 '\t//2nd single line comment\n' +995 '\twidth: 10px;\n' +996 '}')997 t(998 '.tabs{width:10px;//end of line comment\n' +999 '}',1000 # -- output --1001 '.tabs {\n' +1002 '\twidth: 10px; //end of line comment\n' +1003 '}')1004 t(1005 '.tabs{width:10px;//end of line comment\n' +1006 'height:10px;}',1007 # -- output --1008 '.tabs {\n' +1009 '\twidth: 10px; //end of line comment\n' +1010 '\theight: 10px;\n' +1011 '}')1012 t(1013 '.tabs{width:10px;//end of line comment\n' +1014 'height:10px;//another\n' +1015 '}',1016 # -- output --1017 '.tabs {\n' +1018 '\twidth: 10px; //end of line comment\n' +1019 '\theight: 10px; //another\n' +1020 '}')1021 #============================================================1022 # Handle LESS property name interpolation1023 self.reset_options();1024 t(1025 'tag {\n' +1026 '\t@{prop}: none;\n' +1027 '}')1028 t(1029 'tag{@{prop}:none;}',1030 # -- output --1031 'tag {\n' +1032 '\t@{prop}: none;\n' +1033 '}')1034 t(1035 'tag{ @{prop}: none;}',1036 # -- output --1037 'tag {\n' +1038 '\t@{prop}: none;\n' +1039 '}')1040 1041 # can also be part of property name1042 t(1043 'tag {\n' +1044 '\tdynamic-@{prop}: none;\n' +1045 '}')1046 t(1047 'tag{dynamic-@{prop}:none;}',1048 # -- output --1049 'tag {\n' +1050 '\tdynamic-@{prop}: none;\n' +1051 '}')1052 t(1053 'tag{ dynamic-@{prop}: none;}',1054 # -- output --1055 'tag {\n' +1056 '\tdynamic-@{prop}: none;\n' +1057 '}')1058 #============================================================1059 # Handle LESS property name interpolation, test #6311060 self.reset_options();1061 t(1062 '.generate-columns(@n, @i: 1) when (@i =< @n) {\n' +1063 '\t.column-@{i} {\n' +1064 '\t\twidth: (@i * 100% / @n);\n' +1065 '\t}\n' +1066 '\t.generate-columns(@n, (@i + 1));\n' +1067 '}')1068 t(1069 '.generate-columns(@n,@i:1) when (@i =< @n){.column-@{i}{width:(@i * 100% / @n);}.generate-columns(@n,(@i + 1));}',1070 # -- output --1071 '.generate-columns(@n, @i: 1) when (@i =< @n) {\n' +1072 '\t.column-@{i} {\n' +1073 '\t\twidth: (@i * 100% / @n);\n' +1074 '\t}\n' +1075 '\t.generate-columns(@n, (@i + 1));\n' +1076 '}')1077 #============================================================1078 # Psuedo-classes vs Variables1079 self.reset_options();1080 t('@page :first {}')1081 1082 # Assume the colon goes with the @name. If we're in LESS, this is required regardless of the at-string.1083 t('@page:first {}', '@page: first {}')1084 t('@page: first {}')1085 #============================================================1086 # SASS/SCSS1087 self.reset_options();1088 1089 # Basic Interpolation1090 t(1091 'p {\n' +1092 '\t$font-size: 12px;\n' +1093 '\t$line-height: 30px;\n' +1094 '\tfont: #{$font-size}/#{$line-height};\n' +1095 '}')1096 t('p.#{$name} {}')1097 t(1098 '@mixin itemPropertiesCoverItem($items, $margin) {\n' +1099 '\twidth: calc((100% - ((#{$items} - 1) * #{$margin}rem)) / #{$items});\n' +1100 '\tmargin: 1.6rem #{$margin}rem 1.6rem 0;\n' +1101 '}')1102 1103 # Multiple filed issues in LESS due to not(:blah)1104 t('&:first-of-type:not(:last-child) {}')1105 t(1106 'div {\n' +1107 '\t&:not(:first-of-type) {\n' +1108 '\t\tbackground: red;\n' +1109 '\t}\n' +1110 '}')1111 #============================================================1112 # Proper handling of colon in selectors1113 self.reset_options();1114 self.options.selector_separator_newline = false1115 t('a :b {}')1116 t('a ::b {}')1117 t('a:b {}')1118 t('a::b {}')1119 t(1120 'a {}, a::b {}, a ::b {}, a:b {}, a :b {}',1121 # -- output --1122 'a {}\n' +1123 ', a::b {}\n' +1124 ', a ::b {}\n' +1125 ', a:b {}\n' +1126 ', a :b {}')1127 t(1128 '.card-blue ::-webkit-input-placeholder {\n' +1129 '\tcolor: #87D1FF;\n' +1130 '}')1131 t(1132 'div [attr] :not(.class) {\n' +1133 '\tcolor: red;\n' +1134 '}')1135 #============================================================1136 # Regresssion Tests1137 self.reset_options();1138 self.options.selector_separator_newline = false1139 t(1140 '@media(min-width:768px) {\n' +1141 '\t.selector::after {\n' +1142 '\t\t/* property: value */\n' +1143 '\t}\n' +1144 '\t.other-selector {\n' +1145 '\t\t/* property: value */\n' +1146 '\t}\n' +1147 '}')1148 t(1149 '.fa-rotate-270 {\n' +1150 '\tfilter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);\n' +1151 '}')1152 #============================================================1153 # Important 1154 self.reset_options();1155 t(1156 'a {\n' +1157 '\tcolor: blue !important;\n' +1158 '}',1159 # -- output --1160 'a {\n' +1161 '\tcolor: blue !important;\n' +1162 '}')1163 t(1164 'a {\n' +1165 '\tcolor: blue!important;\n' +1166 '}',1167 # -- output --1168 'a {\n' +1169 '\tcolor: blue !important;\n' +1170 '}')1171 t(1172 'a {\n' +1173 '\tcolor: blue !important;\n' +1174 '}')1175 #============================================================1176 # 1177 self.reset_options();1178 def testNewline(self):1179 self.reset_options()1180 t = self.decodesto1181 self.options.end_with_newline = True1182 t("", "\n")1183 t("\n", "\n")1184 t(".tabs{}\n", ".tabs {}\n")1185 t(".tabs{}", ".tabs {}\n")1186 def testBasics(self):1187 self.reset_options()1188 t = self.decodesto1189 t("", "")1190 t("\n", "")1191 t(".tabs{}\n", ".tabs {}")1192 t(".tabs{}", ".tabs {}")1193 t(".tabs{color:red}", ".tabs {\n\tcolor: red\n}")1194 t(".tabs{color:rgb(255, 255, 0)}", ".tabs {\n\tcolor: rgb(255, 255, 0)\n}")1195 t(".tabs{background:url('back.jpg')}", ".tabs {\n\tbackground: url('back.jpg')\n}")1196 t("#bla, #foo{color:red}", "#bla,\n#foo {\n\tcolor: red\n}")1197 t("@media print {.tab{}}", "@media print {\n\t.tab {}\n}")1198 t("@media print {.tab{background-image:url(foo@2x.png)}}", "@media print {\n\t.tab {\n\t\tbackground-image: url(foo@2x.png)\n\t}\n}")1199 t("a:before {\n" +1200 "\tcontent: 'a{color:black;}\"\"\\'\\'\"\\n\\n\\na{color:black}\';\n" +1201 "}");1202 # may not eat the space before "["1203 t('html.js [data-custom="123"] {\n\topacity: 1.00;\n}')1204 t('html.js *[data-custom="123"] {\n\topacity: 1.00;\n}')1205 # lead-in whitespace determines base-indent.1206 # lead-in newlines are stripped.1207 t("\n\na, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}")1208 t(" a, img {padding: 0.2px}", " a,\n img {\n \tpadding: 0.2px\n }")1209 t(" \t \na, img {padding: 0.2px}", " \t a,\n \t img {\n \t \tpadding: 0.2px\n \t }")1210 t("\n\n a, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}")1211 def testSeperateSelectors(self):1212 self.reset_options()1213 t = self.decodesto1214 t("#bla, #foo{color:red}", "#bla,\n#foo {\n\tcolor: red\n}")1215 t("a, img {padding: 0.2px}", "a,\nimg {\n\tpadding: 0.2px\n}")1216 def testBlockNesting(self):1217 self.reset_options()1218 t = self.decodesto1219 t("#foo {\n\tbackground-image: url(foo@2x.png);\n\t@font-face {\n\t\tfont-family: 'Bitstream Vera Serif Bold';\n\t\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n\t}\n}")1220 t("@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo@2x.png);\n\t}\n\t@font-face {\n\t\tfont-family: 'Bitstream Vera Serif Bold';\n\t\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n\t}\n}")1221# @font-face {1222# font-family: 'Bitstream Vera Serif Bold';1223# src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');1224# }1225# @media screen {1226# #foo:hover {1227# background-image: url(foo.png);1228# }1229# @media screen and (min-device-pixel-ratio: 2) {1230# @font-face {1231# font-family: 'Helvetica Neue'1232# }1233# #foo:hover {1234# background-image: url(foo@2x.png);1235# }1236# }1237# }1238 t("@font-face {\n\tfont-family: 'Bitstream Vera Serif Bold';\n\tsrc: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n}\n@media screen {\n\t#foo:hover {\n\t\tbackground-image: url(foo.png);\n\t}\n\t@media screen and (min-device-pixel-ratio: 2) {\n\t\t@font-face {\n\t\t\tfont-family: 'Helvetica Neue'\n\t\t}\n\t\t#foo:hover {\n\t\t\tbackground-image: url(foo@2x.png);\n\t\t}\n\t}\n}")1239 def testOptions(self):1240 self.reset_options()1241 self.options.indent_size = 21242 self.options.indent_char = ' '1243 self.options.selector_separator_newline = False1244 t = self.decodesto1245 # pseudo-classes and pseudo-elements1246 t("#foo:hover {\n background-image: url(foo@2x.png)\n}")1247 t("#foo *:hover {\n color: purple\n}")1248 t("::selection {\n color: #ff0000;\n}")1249 # TODO: don't break nested pseduo-classes1250 t("@media screen {.tab,.bat:hover {color:red}}", "@media screen {\n .tab, .bat:hover {\n color: red\n }\n}")1251 # particular edge case with braces and semicolons inside tags that allows custom text1252 t( "a:not(\"foobar\\\";{}omg\"){\ncontent: 'example\\';{} text';\ncontent: \"example\\\";{} text\";}",1253 "a:not(\"foobar\\\";{}omg\") {\n content: 'example\\';{} text';\n content: \"example\\\";{} text\";\n}")1254 def testLessCss(self):1255 self.reset_options()1256 t = self.decodesto1257 t('.well{ \n @well-bg:@bg-color;@well-fg:@fg-color;}','.well {\n\t@well-bg: @bg-color;\n\t@well-fg: @fg-color;\n}')1258 t('.well {&.active {\nbox-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;}}',1259 '.well {\n' +1260 '\t&.active {\n' +1261 '\t\tbox-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;\n' +1262 '\t}\n' +1263 '}')1264 t('a {\n' +1265 '\tcolor: blue;\n' +1266 '\t&:hover {\n' +1267 '\t\tcolor: green;\n' +1268 '\t}\n' +1269 '\t& & &&&.active {\n' +...
python.mustache
Source:python.mustache
...29 options = None30 @classmethod31 def setUpClass(cls):32 pass33 def reset_options(self):34 false = False35 true = True36 default_options = cssbeautifier.default_options()37 default_options.indent_size = 438 default_options.indent_char = ' '39 default_options.selector_separator_newline = true40 default_options.end_with_newline = false41 default_options.newline_between_rules = false42{{#default_options}} default_options.{{name}} = {{&value}}43{{/default_options}}44 self.options = copy.copy(default_options)45 def testGenerated(self):46 self.reset_options()47 test_fragment = self.decodesto48 t = self.decodesto49 false = False50 true = True51{{#groups}}{{#set_mustache_tags}}.{{/set_mustache_tags}}52 #============================================================53 {{^matrix}}54 # {{&name}}55 self.reset_options()56 {{#options}}57 self.options.{{name}} = {{&value}}58 {{/options}}59 {{#tests}}60 {{#test_line}}.{{/test_line}}61 {{/tests}}62 {{/matrix}}63 {{#matrix}}64 # {{&name}} - ({{#matrix_context_string}}.{{/matrix_context_string}})65 self.reset_options()66 {{#options}}67 self.options.{{name}} = {{&value}}68 {{/options}}69 {{#tests}}70 {{#test_line}}.{{/test_line}}71 {{/tests}}72 {{/matrix}}73{{#unset_mustache_tags}}.{{/unset_mustache_tags}}{{/groups}}74 def testNewline(self):75 self.reset_options()76 t = self.decodesto77 self.options.end_with_newline = True78 t("", "\n")79 t("\n", "\n")80 t(".tabs{}\n", ".tabs {}\n")81 t(".tabs{}", ".tabs {}\n")82 def testBasics(self):83 self.reset_options()84 t = self.decodesto85 self.reset_options()86 #============================================================87 t(None, "")88 self.reset_options()89 #============================================================90 # Test user pebkac protection, converts dash names to underscored names91 setattr(self.options, 'end-with-newline', True)92 t(None, '\n')93 94 self.reset_options()95 #============================================================96 t("", "")97 t("\n", "")98 t(".tabs{}\n", ".tabs {}")99 t(".tabs{}", ".tabs {}")100 t(".tabs{color:red}", ".tabs {\n color: red\n}")101 t(".tabs{color:rgb(255, 255, 0)}", ".tabs {\n color: rgb(255, 255, 0)\n}")102 t(".tabs{background:url('back.jpg')}", ".tabs {\n background: url('back.jpg')\n}")103 t("#bla, #foo{color:red}", "#bla,\n#foo {\n color: red\n}")104 t("@media print {.tab{}}", "@media print {\n .tab {}\n}")105 t("@media print {.tab{background-image:url(foo@2x.png)}}", "@media print {\n .tab {\n background-image: url(foo@2x.png)\n }\n}")106 t("a:before {\n" +107 " content: 'a{color:black;}\"\"\\'\\'\"\\n\\n\\na{color:black}\';\n" +108 "}")109 # may not eat the space before "["110 t('html.js [data-custom="123"] {\n opacity: 1.00;\n}')111 t('html.js *[data-custom="123"] {\n opacity: 1.00;\n}')112 # lead-in whitespace determines base-indent.113 # lead-in newlines are stripped.114 t("\n\na, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")115 t(" a, img {padding: 0.2px}", " a,\n img {\n padding: 0.2px\n }")116 t(" \na, img {padding: 0.2px}", " a,\n img {\n padding: 0.2px\n }")117 t("\n\n a, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")118 def testSeperateSelectors(self):119 self.reset_options()120 t = self.decodesto121 t("#bla, #foo{color:red}", "#bla,\n#foo {\n color: red\n}")122 t("a, img {padding: 0.2px}", "a,\nimg {\n padding: 0.2px\n}")123 def testBlockNesting(self):124 self.reset_options()125 t = self.decodesto126 t("#foo {\n background-image: url(foo@2x.png);\n @font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n }\n}")127 t("@media screen {\n #foo:hover {\n background-image: url(foo@2x.png);\n }\n @font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n }\n}")128# @font-face {129# font-family: 'Bitstream Vera Serif Bold';130# src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');131# }132# @media screen {133# #foo:hover {134# background-image: url(foo.png);135# }136# @media screen and (min-device-pixel-ratio: 2) {137# @font-face {138# font-family: 'Helvetica Neue'139# }140# #foo:hover {141# background-image: url(foo@2x.png);142# }143# }144# }145 t("@font-face {\n font-family: 'Bitstream Vera Serif Bold';\n src: url('http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf');\n}\n@media screen {\n #foo:hover {\n background-image: url(foo.png);\n }\n @media screen and (min-device-pixel-ratio: 2) {\n @font-face {\n font-family: 'Helvetica Neue'\n }\n #foo:hover {\n background-image: url(foo@2x.png);\n }\n }\n}")146 def testOptions(self):147 self.reset_options()148 self.options.indent_size = 2149 self.options.indent_char = ' '150 self.options.selector_separator_newline = False151 t = self.decodesto152 # pseudo-classes and pseudo-elements153 t("#foo:hover {\n background-image: url(foo@2x.png)\n}")154 t("#foo *:hover {\n color: purple\n}")155 t("::selection {\n color: #ff0000;\n}")156 # TODO: don't break nested pseduo-classes157 t("@media screen {.tab,.bat:hover {color:red}}", "@media screen {\n .tab, .bat:hover {\n color: red\n }\n}")158 # particular edge case with braces and semicolons inside tags that allows custom text159 t( "a:not(\"foobar\\\";{}omg\"){\ncontent: 'example\\';{} text';\ncontent: \"example\\\";{} text\";}",160 "a:not(\"foobar\\\";{}omg\") {\n content: 'example\\';{} text';\n content: \"example\\\";{} text\";\n}")161 def testLessCss(self):162 self.reset_options()163 t = self.decodesto164 t('.well{ \n @well-bg:@bg-color;@well-fg:@fg-color;}','.well {\n @well-bg: @bg-color;\n @well-fg: @fg-color;\n}')165 t('.well {&.active {\nbox-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;}}',166 '.well {\n' +167 ' &.active {\n' +168 ' box-shadow: 0 1px 1px @border-color, 1px 0 1px @border-color;\n' +169 ' }\n' +170 '}')171 t('a {\n' +172 ' color: blue;\n' +173 ' &:hover {\n' +174 ' color: green;\n' +175 ' }\n' +176 ' & & &&&.active {\n' +...
test_mumps.py
Source:test_mumps.py
...21 {'nrhs' : 10, 'sparse_rhs' : True},22 {'nrhs' : 2, 'ordering' : 'amd', 'sparse_rhs' : True}]23def test_output():24 for opts in opt_list:25 reset_options()26 options(**opts)27 _test_sparse.test_output(smatrix)28def test_one_lead():29 for opts in opt_list:30 reset_options()31 options(**opts)32 _test_sparse.test_one_lead(smatrix)33def test_smatrix_shape():34 for opts in opt_list:35 reset_options()36 options(**opts)37 _test_sparse.test_smatrix_shape(smatrix)38def test_two_equal_leads():39 for opts in opt_list:40 reset_options()41 options(**opts)42 _test_sparse.test_two_equal_leads(smatrix)43def test_graph_system():44 for opts in opt_list:45 reset_options()46 options(**opts)47 _test_sparse.test_graph_system(smatrix)48def test_singular_graph_system():49 for opts in opt_list:50 reset_options()51 options(**opts)52 _test_sparse.test_singular_graph_system(smatrix)53def test_tricky_singular_hopping():54 for opts in opt_list:55 reset_options()56 options(**opts)57 _test_sparse.test_tricky_singular_hopping(smatrix)58def test_many_leads():59 for opts in opt_list:60 reset_options()61 options(**opts)62 _test_sparse.test_many_leads(greens_function, smatrix)63def test_selfenergy():64 for opts in opt_list:65 reset_options()66 options(**opts)67 _test_sparse.test_selfenergy(greens_function, smatrix)68def test_selfenergy_reflection():69 for opts in opt_list:70 reset_options()71 options(**opts)72 _test_sparse.test_selfenergy_reflection(greens_function, smatrix)73def test_very_singular_leads():74 for opts in opt_list:75 reset_options()76 options(**opts)77 _test_sparse.test_very_singular_leads(smatrix)78def test_ldos():79 for opts in opt_list:80 reset_options()81 options(**opts)82 _test_sparse.test_ldos(ldos)83def test_wavefunc_ldos_consistency():84 for opts in opt_list:85 options(**opts)86 _test_sparse.test_wavefunc_ldos_consistency(wave_function, ldos)87# We need to keep testing 'args', but we don't want to see88# all the deprecation warnings in the test logs89@pytest.mark.filterwarnings("ignore:.*'args' parameter")90def test_arg_passing():...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!