How to use test_single_level method in tavern

Best Python code snippet using tavern

test_operations.py

Source:test_operations.py Github

copy

Full Screen

...25 obj2 = {"foo": "1"}26 gold = {}27 output = diff(obj1, obj2)28 self.assertEqual(gold, output)29 def test_single_level(self):30 obj1 = {"foo": None, "bar": 1, "qux": 1}31 obj2 = {"foo": 1, "baz": 2}32 gold = {"bar": 1, "qux": 1}33 output = diff(obj1, obj2)34 self.assertEqual(gold, output)35 def test_mult_level(self):36 obj1 = {"foo": {"bar": {"baz": 1, "dur": 1}}}37 obj2 = {"foo": {"bar": {"qux": 1}}}38 gold = {"foo": {"bar": {"baz": 1, "dur": 1}}}39 output = diff(obj1, obj2)40 self.assertEqual(gold, output)41 def test_multi_level_does_not_return_falsy_dict(self):42 obj1 = {"foo": {"bar": {"baz": 1}}}43 obj2 = {"foo": {"bar": {"baz": 1}}}44 gold = {}45 output = diff(obj1, obj2)46 self.assertEqual(gold, output)47 def test_pseudo_immutability(self):48 obj1 = {"foo": 1, "bar": [1, 2]}49 obj2 = {"foo": 1}50 gold = {"bar": [1, 2]}51 output = diff(obj1, obj2)52 obj1["bar"].append(3)53 self.assertEqual(gold, output)54class test_put(unittest.TestCase):55 def test_falsy_left_side(self):56 obj1 = {}57 obj2 = {"foo": 1}58 gold = {"foo": 1}59 output = put(obj1, obj2)60 self.assertEqual(gold, output)61 def test_falsy_right_side(self):62 obj1 = {"foo": 1}63 obj2 = {}64 gold = {"foo": 1}65 output = put(obj1, obj2)66 self.assertEqual(gold, output)67 def test_no_change(self):68 obj1 = {"foo": 1}69 obj2 = {"foo": 1}70 gold = {"foo": 1}71 output = put(obj1, obj2)72 self.assertEqual(gold, output)73 def test_no_diff_str(self):74 # caught bug with iterable strings75 # changes behavior where we do not want to update a76 # key with default settings if it already exists77 obj1 = {"foo": "1"}78 obj2 = {"foo": "2"}79 gold = {"foo": "2"}80 output = put(obj1, obj2)81 self.assertEqual(gold, output)82 def test_single_level(self):83 obj1 = {"bar": 1, "qux": 1}84 obj2 = {"foo": 1}85 gold = {"bar": 1, "foo": 1, "qux": 1}86 output = put(obj1, obj2)87 self.assertEqual(gold, output)88 def test_mult_level(self):89 obj1 = {"foo": {"bar": {"baz": 1, "dur": 1}}}90 obj2 = {"foo": {"bar": {"qux": 1}}}91 gold = {92 "foo": {"bar": {"qux": 1, "baz": 1, "dur": 1}}93 }94 output = put(obj1, obj2)95 self.assertEqual(gold, output)96 def test_pseudo_immutability(self):97 obj1 = {"foo": 1}98 obj2 = {"bar": [1, 2]}99 gold = {"foo": 1, "bar": [1, 2]}100 output = put(obj1, obj2)101 obj2["bar"].append(3)102 self.assertEqual(gold, output)103class test_cut(unittest.TestCase):104 def test_falsy_left_side(self):105 obj1 = {}106 obj2 = {"foo": 1}107 gold = {"foo": 1}108 output = cut(obj1, obj2)109 self.assertEqual(gold, output)110 def test_falsy_right_side(self):111 obj1 = {"foo": 1}112 obj2 = {}113 gold = {}114 output = cut(obj1, obj2)115 self.assertEqual(gold, output)116 def test_no_change(self):117 obj1 = {"bar": 1}118 obj2 = {"foo": 1}119 gold = {"foo": 1}120 output = cut(obj1, obj2)121 self.assertEqual(gold, output)122 def test_no_diff_str(self):123 obj1 = {"foo": "1"}124 obj2 = {"foo": "2"}125 gold = {}126 output = cut(obj1, obj2)127 self.assertEqual(gold, output)128 def test_single_level(self):129 obj1 = {"bar": None, "baz": None}130 obj2 = {"foo": 1, "bar": 1, "baz": 1}131 gold = {"foo": 1}132 output = cut(obj1, obj2)133 self.assertEqual(gold, output)134 def test_mult_level(self):135 obj1 = {"foo": {"bar": {"baz": 1, "qux": 1}}}136 obj2 = {"foo": {"bar": {"baz": 1, "qux": 1}}}137 gold = {}138 output = cut(obj1, obj2)139 self.assertEqual(gold, output)140 def test_pseudo_immutability(self):141 obj1 = {"foo": 1}142 obj2 = {"foo": 1, "bar": [1, 2]}...

Full Screen

Full Screen

test_toc_generator.py

Source:test_toc_generator.py Github

copy

Full Screen

...8 def test_no_headings(self):9 actual = self.t.generate_outline([])10 expected = []11 self.assertEqual(expected, actual)12 def test_single_level(self):13 actual = self.t.generate_outline([14 [1, u'T1'],15 [1, u'T2'],16 ])17 expected = [18 [u'T1', []],19 [u'T2', []],20 ]21 self.assertEqual(expected, actual)22 def test_multi_level_case_1(self):23 actual = self.t.generate_outline([24 [1, u'T1'],25 [1, u'T2'],26 [2, u'T2-1'],27 [2, u'T2-2'],28 [1, u'T3'],29 ])30 expected = [31 [u'T1', []],32 [u'T2', [33 [u'T2-1', []],34 [u'T2-2', []],35 ]],36 [u'T3', []],37 ]38 self.assertEqual(expected, actual)39 def test_multi_level_case_2(self):40 actual = self.t.generate_outline([41 [1, u'T1'],42 [2, u'T1-1'],43 [3, u'T1-1-1'],44 [3, u'T1-1-2'],45 [1, u'T2'],46 ])47 expected = [48 [u'T1', [49 [u'T1-1', [50 [u'T1-1-1', []],51 [u'T1-1-2', []],52 ]],53 ]],54 [u'T2', []],55 ]56 self.assertEqual(expected, actual)57 def test_invalid_level(self):58 self.assertRaises(ValueError, self.t.generate_outline, [[1, u'T1'], [3, u'T2']])59 self.assertRaises(ValueError, self.t.generate_outline, [[2, u'T1'], [3, u'T2']])60class PathTest(unittest.TestCase):61 def setUp(self):62 self.t = TocGenerator('')63 def test_single_level(self):64 actual = self.t.generate_path([65 [u'제목1', []],66 [u'제목2', []],67 ])68 expected = [69 u'제목1',70 u'제목2',71 ]72 self.assertEqual(expected, actual)73 def test_multi_level(self):74 actual = self.t.generate_path([75 [u'T1', []],76 [u'제목2', [77 [u'제목2-1', []],...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tavern automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful