コード例 #1
0
 def test_callable_key(self):
     formatter = JSONFormatter()
     formatter.configure(key=lambda x: x['foo'][::-1])
     h.assert_equal(formatter.render({'foo': 'bar'}), '"rab"')
コード例 #2
0
 def test_string_key(self):
     formatter = JSONFormatter()
     formatter.configure(key='foo')
     h.assert_equal(formatter.render({'foo': {
         'bar': 'baz'
     }}), '{"bar": "baz"}')
コード例 #3
0
    def test_no_key(self):
        formatter = JSONFormatter()
        formatter.configure()

        h.assert_equal(formatter.render({'foo': 'bar'}), '{"foo": "bar"}')
コード例 #4
0
ファイル: test_formats.py プロジェクト: BigBlueHat/annotateit
 def test_callable_key(self):
     formatter = JSONFormatter()
     formatter.configure(key=lambda x: x['foo'][::-1])
     h.assert_equal(formatter.render({'foo': 'bar'}), '"rab"')
コード例 #5
0
ファイル: test_formats.py プロジェクト: BigBlueHat/annotateit
 def test_string_key(self):
     formatter = JSONFormatter()
     formatter.configure(key='foo')
     h.assert_equal(formatter.render({'foo': {'bar': 'baz'}}), '{"bar": "baz"}')
コード例 #6
0
ファイル: test_formats.py プロジェクト: BigBlueHat/annotateit
    def test_no_key(self):
        formatter = JSONFormatter()
        formatter.configure()

        h.assert_equal(formatter.render({'foo': 'bar'}), '{"foo": "bar"}')