Best Python code snippet using slash
test_typed_list.py
Source:test_typed_list.py
...46 assert l == copy47def test_init_invalid_type():48 with pytest.raises(TypeError):49 _: TypedList[int] = TypedList(int, iterable=[1, 'foo'])50def test_append_invalid_type():51 l: TypedList[int] = TypedList(int)52 with pytest.raises(TypeError):53 l.append('foo')54def test_extend_invalid_type():55 l: TypedList[int] = TypedList(int)56 with pytest.raises(TypeError):57 l.extend([1, 'foo'])58def test_iadd_invalid_type():59 l: TypedList[int] = TypedList(int)60 with pytest.raises(TypeError):61 l += [1, 'foo']62def test_insert_invalid_type():63 l: TypedList[int] = TypedList(int)64 with pytest.raises(TypeError):...
test_collections.py
Source:test_collections.py
...23 """Test append."""24 collection = TestCollection()25 collection.append(1)26 self.assertEqual(collection, [1])27 def test_append_invalid_type(self):28 """Test append."""29 collection = TestCollection()30 with self.assertRaises(TypeError):31 collection.append('1')32 def test_extend_valid_type(self):33 """Test extend."""34 collection = TestCollection()35 collection.extend([1])36 self.assertEqual(collection, [1])37 def test_extend_invalid_type(self):38 """Test extend."""39 collection = TestCollection()40 with self.assertRaises(TypeError):41 collection.extend(['1'])...
test_append.py
Source:test_append.py
...77 check_append_no_time_key(head, new)78 dic = new.to_dict()79 check_append_no_time_key(head, dic, ignore_index=True)80 check_append_no_time_key(head, [dic], ignore_index=True)81def test_append_invalid_type(tencent: DataFrame):82 stock = StockDataFrame(tencent, date_col=TIME_KEY, copy=True)83 with pytest.raises(TypeError, match='int'):84 stock.append(1)85 with pytest.raises(TypeError, match="list of <class 'int'>"):86 stock.append([1])87 with pytest.raises(TypeError, match="list of <class 'list'>"):88 stock.append([[]])89# Github issue #2290def test_empty_df_append(tencent: DataFrame):91 stock = StockDataFrame(date_col=TIME_KEY)92 stock = stock.append(tencent)93 assert isinstance(stock, StockDataFrame)94 assert stock._cumulator._date_col == TIME_KEY95def test_append_meta(tencent: DataFrame):...
test_buffer.py
Source:test_buffer.py
...58 buffer.append(b'bar')59 self.assertTrue(buffer.value() == b'foobar')60 self.assertTrue(buffer.length() == 6)61 ## }}}62 ## {{{ TestByteBuffer.test_append_invalid_type()63 def test_append_invalid_type(self):64 buffer = ByteBuffer()65 with self.assertRaises(TypeError):66 buffer.append(True)67 ## }}}68 ## {{{ TestByteBuffer.test_clear()69 def test_clear(self):70 buffer = ByteBuffer(buf=b'foo')71 self.assertTrue(buffer.value() == b'foo')72 buffer.clear()73 self.assertTrue(buffer.value() == b'')74 self.assertTrue(buffer.length() == 0)75 ## }}}76class TestStringBuffer(unittest.TestCase):77 ## {{{ TestStringBuffer.test_init()78 def test_init(self):79 buffer = StringBuffer()80 self.assertTrue(buffer.length() == 0)81 self.assertTrue(buffer.value() == '')82 ## }}}83 ## {{{ TestStringBuffer.test_init_arg()84 def test_init_arg(self):85 buf = 'foo'86 buffer = StringBuffer(buf=buf)87 self.assertTrue(buffer.length() == len(buf))88 self.assertTrue(buffer.value() == buf)89 ## }}}90 ## {{{ TestStringBuffer.test_append()91 def test_append(self):92 buffer = StringBuffer()93 buffer.append('foo')94 buffer.append('bar')95 self.assertTrue(buffer.value() == 'foobar')96 self.assertTrue(buffer.length() == 6)97 ## }}}98 ## {{{ TestStringBuffer.test_append_invalid_type()99 def test_append_invalid_type(self):100 buffer = StringBuffer()101 with self.assertRaises(TypeError):102 buffer.append(True)103 ## }}}104 ## {{{ TestStringBuffer.test_clear()105 def test_clear(self):106 buffer = StringBuffer(buf='foo')107 self.assertTrue(buffer.value() == 'foo')108 buffer.clear()109 self.assertTrue(buffer.value() == '')110 self.assertTrue(buffer.length() == 0)111 ## }}}112##113# vim: ts=2 sw=2 tw=100 et fdm=marker :...
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!!