diff options
author | Benjamin Peterson <devnull@localhost> | 2008-09-11 17:49:10 -0500 |
---|---|---|
committer | Benjamin Peterson <devnull@localhost> | 2008-09-11 17:49:10 -0500 |
commit | 6dd9fa10fa4d2cd51e320a3b3722aa5269786d47 (patch) | |
tree | 13f802f72c147ae3ec1d2f3149cbb50c2e6cd3de /tests/test_token.py | |
parent | 41660325f1d428540795cb7882ba214fb9871bc9 (diff) | |
download | pygments-6dd9fa10fa4d2cd51e320a3b3722aa5269786d47.tar.gz |
move the if __name__ == __main__ test from token.py to its test
Diffstat (limited to 'tests/test_token.py')
-rw-r--r-- | tests/test_token.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/test_token.py b/tests/test_token.py index 8cf779f7..4c83b9ea 100644 --- a/tests/test_token.py +++ b/tests/test_token.py @@ -36,15 +36,17 @@ class TokenTest(unittest.TestCase): self.assert_(token.string_to_tokentype('String') is token.String) def test_sanity_check(self): - try: - try: - old_stdout = sys.stdout - sys.stdout = StringIO.StringIO() - execfile(token.__file__.rstrip('c'), {'__name__': '__main__'}) - finally: - sys.stdout = old_stdout - except SystemExit: - pass + stp = token.STANDARD_TYPES.copy() + stp[token.Token] = '---' # Token and Text do conflict, that is okay + t = {} + for k, v in stp.iteritems(): + t.setdefault(v, []).append(k) + if len(t) == len(stp): + return # Okay + + for k, v in t.iteritems(): + if len(v) > 1: + self.fail("%r has more than one key: %r" % (k, v)) if __name__ == '__main__': |