summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorColin Kennedy <colinvfx@gmail.com>2019-11-30 20:26:27 -0800
committerColin Kennedy <colinvfx@gmail.com>2019-11-30 20:26:27 -0800
commit558f5982d34778bace427131bfd1eddc92d0cd6c (patch)
tree9ce9f4215e27a537c659b7a8e3c9b2645680fff6 /tests
parent5954dd80d4fda4b6fd29aed46b86428eb23eb85f (diff)
downloadpygments-git-558f5982d34778bace427131bfd1eddc92d0cd6c.tar.gz
Added more tests to test_usda.py
Diffstat (limited to 'tests')
-rw-r--r--tests/test_usda.py137
1 files changed, 124 insertions, 13 deletions
diff --git a/tests/test_usda.py b/tests/test_usda.py
index 73e87855..85e21269 100644
--- a/tests/test_usda.py
+++ b/tests/test_usda.py
@@ -60,22 +60,133 @@ class UsdTest(unittest.TestCase):
def test_attribute(self):
normal = 'double foo = 8.0'
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Type, 'double'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '8.0'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(normal),
+ )
+
custom = 'custom double foo = 8.0'
- underscore = 'custom double foo_asfd = 8.0'
- underscore_no_custom = 'double foo_asfd = 8.0'
- array = 'double[] foo_asfd = [10.1, 12.0, 13]'
- namespaced = 'double[] primvar:foo_thing = [10.1, 12.0, 13]'
-
- timeSamples = textwrap.dedent(
- '''\
- custom int[] foo = [8, 10, 14]
- custom int[] foo.timeSamples = {
- 1: [8, 0, 14],
- 2: [-8, 0, 14],
- }
- '''
+
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Token, 'custom'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Keyword.Type, 'double'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '8.0'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(custom),
+ )
+
+ uniform = 'uniform double foo = 8.0'
+
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Token, 'uniform'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Keyword.Type, 'double'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '8.0'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(uniform),
+ )
+
+ custom_uniform = 'custom uniform double foo = 8.0'
+
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Token, 'custom'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Keyword.Token, 'uniform'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Keyword.Type, 'double'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '8.0'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(custom_uniform),
)
+ underscore = 'custom double foo_underscore_name = 8.0'
+
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Token, 'custom'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Keyword.Type, 'double'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo_underscore_name'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '8.0'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(underscore),
+ )
+
+ array = 'double[] foo_underscore_name = [10.1, 12.0, 13]'
+
+ self.assertEqual(
+ [
+ (token.Token.Keyword.Type, 'double[]'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Name.Attribute, 'foo_underscore_name'),
+ (token.Token.Text.Whitespace, ' '),
+ (token.Token.Generic, '='),
+ (token.Token.Text, ' '),
+ (token.Token.Punctuation, '['),
+ (token.Token.Literal.Number, '10.1'),
+ (token.Token.Generic, ','),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '12.0'),
+ (token.Token.Generic, ','),
+ (token.Token.Text, ' '),
+ (token.Token.Literal.Number, '13'),
+ (token.Token.Punctuation, ']'),
+ (token.Token.Text, '\n'),
+ ],
+ self._get(array),
+ )
+
+ # namespaced = 'double[] primvar:foo_thing = [10.1, 12.0, 13]'
+ #
+ # timeSamples = textwrap.dedent(
+ # '''\
+ # custom int[] foo = [8, 10, 14]
+ # custom int[] foo.timeSamples = {
+ # 1: [8, 0, 14],
+ # 2: [-8, 0, 14],
+ # }
+ # '''
+ # )
+
+ # def test_string_priority(self):
+ # raise NotImplementedError()
+ #
# def test_namespace_attribute(self):
# raise NotImplementedError()
#