<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=TFP%EC%98%88%EC%A0%9C%2FQueue</id>
	<title>TFP예제/Queue - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=TFP%EC%98%88%EC%A0%9C%2FQueue"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;action=history"/>
	<updated>2026-05-14T15:58:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=87638&amp;oldid=prev</id>
		<title>Maintenance script: Repair MoniWiki formatting after migration</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=87638&amp;oldid=prev"/>
		<updated>2026-03-29T00:34:31Z</updated>

		<summary type="html">&lt;p&gt;Repair MoniWiki formatting after migration&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:34, 29 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l315&quot;&gt;Line 315:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 315:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  OK&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  OK&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;이쯤 되면 매번 TestCase 작성할 때마다 Queue 인스턴스를 만든다. 이것은 중복되는 일이다. 다음과 같이 setUp 메소드를 구현해주자. 기존에 q를 self.q로 바꾸는것은 replace를 사용하면 쉽다.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;이쯤 되면 매번 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;TestCase&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;작성할 때마다 Queue 인스턴스를 만든다. 이것은 중복되는 일이다. 다음과 같이 setUp 메소드를 구현해주자. 기존에 q를 self.q로 바꾸는것은 replace를 사용하면 쉽다.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  import unittest&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  import unittest&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  from queue import Queue&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  from queue import Queue&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=85014&amp;oldid=prev</id>
		<title>Maintenance script: Repair batch-0003 pages from live compare</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=85014&amp;oldid=prev"/>
		<updated>2026-03-27T00:29:11Z</updated>

		<summary type="html">&lt;p&gt;Repair batch-0003 pages from live compare&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:29, 27 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l140&quot;&gt;Line 140:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 140:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l204&quot;&gt;Line 204:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 204:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l213&quot;&gt;Line 213:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 213:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;len(self.qu_list)-1&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;len(self.qu_list)-1&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  ----------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  ----------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  Ran 2 tests in 0.000s&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  Ran 2 tests in 0.000s&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l269&quot;&gt;Line 269:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 269:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l278&quot;&gt;Line 278:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 278:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;len(self.qu_list)-1&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;len(self.qu_list)-1&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l298&quot;&gt;Line 298:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 298:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l307&quot;&gt;Line 307:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 307:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;len(self.qu_list)-1&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;len(self.qu_list)-1&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l451&quot;&gt;Line 451:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 451:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Queue:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def __init__ (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          self.qu_list = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def enqueue (self, n):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l460&quot;&gt;Line 460:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 460:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def last (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;len(self.qu_list)-1&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          return self.qu_list&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;len(self.qu_list)-1&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      def dequeue (self):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l486&quot;&gt;Line 486:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 486:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[TestFirstProgramming]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[TestFirstProgramming]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=39592&amp;oldid=prev</id>
		<title>imported&gt;Unknown at 05:28, 7 February 2021</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=TFP%EC%98%88%EC%A0%9C/Queue&amp;diff=39592&amp;oldid=prev"/>
		<updated>2021-02-07T05:28:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
== Example - Test First Programming 으로 만들어보는 Queue ==&lt;br /&gt;
솔직히 Python도 처음이고 TFP 도 처음이여서 제대로 했다는 보장이 안된다. --; (특히, count 메소드를 먼저 잡았다는 점에서 두가지 Test Case를 만들었다는 점이 맘에 안든다. 추후에 다른 더 좋은 예제가 생기면 그때 바꿔버리던지 해야지. -_;&lt;br /&gt;
=== 준비. Queue를 만들거다. ===&lt;br /&gt;
&amp;#039;&amp;#039;TestCaseQueue.py&amp;#039;&amp;#039;&lt;br /&gt;
 import unittest&lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Queue.py&amp;#039;&amp;#039;&lt;br /&gt;
 (없음)&lt;br /&gt;
&lt;br /&gt;
=== Queue다. 무엇을 하는 넘일까? ===&lt;br /&gt;
무엇을 해야 할까... 일단 이녀석은 값을 enqueue하면 하나씩 저장될 것이다. 그러면 저장되는 갯수가 늘어날 것이다.&lt;br /&gt;
&lt;br /&gt;
=== Construction... ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;TestCaseQueue.py&amp;#039;&amp;#039;&lt;br /&gt;
 import unittest&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.count(), 1)&lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Queue.py&amp;#039;&amp;#039;&lt;br /&gt;
 (없음)&lt;br /&gt;
&amp;#039;&amp;#039;결과&amp;#039;&amp;#039;&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 ERROR: testCount (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 5, in testCount&lt;br /&gt;
     q = Queue ()&lt;br /&gt;
 NameError: global name &amp;#039;Queue&amp;#039; is not defined&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.060s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (errors=1)&lt;br /&gt;
&lt;br /&gt;
Python 이 Queue 클래스를 요구하는군. Queue 클래스 만들라고 하니까 만들어주자.&lt;br /&gt;
&amp;#039;&amp;#039;Queue.py&amp;#039;&amp;#039;&lt;br /&gt;
 class Queue:&lt;br /&gt;
     pass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;결과&amp;#039;&amp;#039;&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 ERROR: testCount (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 7, in testCount&lt;br /&gt;
     q.enqueue (10)&lt;br /&gt;
 AttributeError: Queue instance has no attribute &amp;#039;enqueue&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (errors=1)&lt;br /&gt;
&lt;br /&gt;
enqueue 가 없다고 한다. enqueue 도 채워주자. count 도 잠시나마 채워주자.&lt;br /&gt;
&amp;#039;&amp;#039;Queue.py&amp;#039;&amp;#039;&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         pass&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return 0&lt;br /&gt;
&amp;#039;&amp;#039;결과&amp;#039;&amp;#039;&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 FAIL: testCount (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 8, in testCount&lt;br /&gt;
     self.assertEquals (q.count(), 1)&lt;br /&gt;
   File &amp;quot;C:\PYTHON22\lib\unittest.py&amp;quot;, line 286, in failUnlessEqual&lt;br /&gt;
     raise self.failureException, \&lt;br /&gt;
 AssertionError: 0 != 1&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (failures=1)&lt;br /&gt;
count 가 안늘어나는군. 장난 칠까.. --a&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         pass&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return 1&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.060s&lt;br /&gt;
 &lt;br /&gt;
 OK&lt;br /&gt;
그러면 다음과 같은 경우는?&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.count(), 1)&lt;br /&gt;
         q.enqueue (20)&lt;br /&gt;
         self.assertEquals (q.count(), 2)&lt;br /&gt;
         q.enqueue (30)&lt;br /&gt;
         self.assertEquals (q.count(), 3)&lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 FAIL: testCount (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 10, in testCount&lt;br /&gt;
     suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
   File &amp;quot;C:\PYTHON22\lib\unittest.py&amp;quot;, line 286, in failUnlessEqual&lt;br /&gt;
     raise self.failureException, \&lt;br /&gt;
 AssertionError: 1 != 2&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.050s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (failures=1)&lt;br /&gt;
&lt;br /&gt;
자. enqueue 를 만들고 count를 세어보자.&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def __init__ (self):&lt;br /&gt;
         self.qu_list = []&lt;br /&gt;
     &lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         pass&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return len (self.qu_list)&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 FAIL: testCount (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 8, in testCount&lt;br /&gt;
     self.assertEquals (q.count(), 1)&lt;br /&gt;
   File &amp;quot;C:\PYTHON22\lib\unittest.py&amp;quot;, line 286, in failUnlessEqual&lt;br /&gt;
     raise self.failureException, \&lt;br /&gt;
 AssertionError: 0 != 1&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 1 tests in 0.060s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (failures=1)&lt;br /&gt;
&lt;br /&gt;
enqueue를 보장하기 위한 테스트를 먼저 생각해보자. queue는 말 그대로 안에 들어가는 값이 하나하나 늘어난다. First Input First Out이다.&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def testEnqueue (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.last(), 10)&lt;br /&gt;
         q.enqueue (20)&lt;br /&gt;
         self.assertEquals (q.last(), 20)&lt;br /&gt;
     &lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.count(), 1)&lt;br /&gt;
         q.enqueue (20)&lt;br /&gt;
         self.assertEquals (q.count(), 2)&lt;br /&gt;
         q.enqueue (30)&lt;br /&gt;
         self.assertEquals (q.count(), 3)&lt;br /&gt;
         &lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 ERROR: testEnqueue (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 8, in testEnqueue&lt;br /&gt;
     self.assertEquals (q.count(), 1)&lt;br /&gt;
 AttributeError: Queue instance has no attribute &amp;#039;last&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 2 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (errors=1)&lt;br /&gt;
&lt;br /&gt;
last메소드를 만들어주자.&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def __init__ (self):&lt;br /&gt;
         self.qu_list = []&lt;br /&gt;
     &lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         self.qu_list.append(n)&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return len (self.qu_list)&lt;br /&gt;
 &lt;br /&gt;
     def last (self):&lt;br /&gt;
         return self.qu_list[len(self.qu_list)-1]&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 2 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 OK&lt;br /&gt;
&lt;br /&gt;
dequeue를 만들어보자.&lt;br /&gt;
dequeue 인 경우 두가지를 생각해볼 수 있겠다. 하나는 최초의 값이 제대로 리턴이 되는 것과, queue안에 저장된 갯수가 줄어든다는 점이다.&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def testEnqueue (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.last(), 10)&lt;br /&gt;
         q.enqueue (20)&lt;br /&gt;
         self.assertEquals (q.last(), 20)&lt;br /&gt;
     &lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (10)&lt;br /&gt;
         self.assertEquals (q.count(), 1)&lt;br /&gt;
         q.enqueue (20)&lt;br /&gt;
         self.assertEquals (q.count(), 2)&lt;br /&gt;
         q.enqueue (30)&lt;br /&gt;
         self.assertEquals (q.count(), 3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueData (self):&lt;br /&gt;
         q = Queue ()&lt;br /&gt;
         q.enqueue (1)&lt;br /&gt;
         q.enqueue (2)&lt;br /&gt;
         q.enqueue (3)&lt;br /&gt;
         self.assertEquals (q.dequeue(),1)&lt;br /&gt;
         self.assertEquals (q.dequeue(),2)&lt;br /&gt;
         self.assertEquals (q.dequeue(),3)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 ERROR: testDequeueData (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 26, in testDequeueData&lt;br /&gt;
 AttributeError: Queue instance has no attribute &amp;#039;dequeue&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 3 tests in 0.050s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (errors=1)&lt;br /&gt;
dequeue 메소드가 없다고 나온다. 요구하는데로 채워주자.&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def __init__ (self):&lt;br /&gt;
         self.qu_list = []&lt;br /&gt;
     &lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         self.qu_list.append(n)&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return len (self.qu_list)&lt;br /&gt;
 &lt;br /&gt;
     def last (self):&lt;br /&gt;
         return self.qu_list[len(self.qu_list)-1]&lt;br /&gt;
 &lt;br /&gt;
     def dequeue (self):&lt;br /&gt;
         return 0&lt;br /&gt;
 ======================================================================&lt;br /&gt;
 FAIL: testDequeueData (TestCaseQueue.QueueTestCase)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;C:\USER\reset\TestCaseQueue.py&amp;quot;, line 26, in testDequeueData&lt;br /&gt;
   File &amp;quot;C:\PYTHON22\lib\unittest.py&amp;quot;, line 286, in failUnlessEqual&lt;br /&gt;
     raise self.failureException, \&lt;br /&gt;
 AssertionError: 0 != 1&lt;br /&gt;
 &lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 3 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 FAILED (failures=1)&lt;br /&gt;
자.. dequeue를 구현하자.&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def __init__ (self):&lt;br /&gt;
         self.qu_list = []&lt;br /&gt;
     &lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         self.qu_list.append(n)&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return len (self.qu_list)&lt;br /&gt;
 &lt;br /&gt;
     def last (self):&lt;br /&gt;
         return self.qu_list[len(self.qu_list)-1]&lt;br /&gt;
 &lt;br /&gt;
     def dequeue (self):&lt;br /&gt;
         return self.qu_list.pop(0)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 3 tests in 0.000s&lt;br /&gt;
 &lt;br /&gt;
 OK&lt;br /&gt;
이쯤 되면 매번 TestCase 작성할 때마다 Queue 인스턴스를 만든다. 이것은 중복되는 일이다. 다음과 같이 setUp 메소드를 구현해주자. 기존에 q를 self.q로 바꾸는것은 replace를 사용하면 쉽다.&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def setUp (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
     def testEnqueue (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.last(), 10)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.last(), 20)&lt;br /&gt;
     &lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.count(), 1)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.count(), 2)&lt;br /&gt;
         self.q.enqueue (30)&lt;br /&gt;
         self.assertEquals (self.q.count(), 3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueData (self):&lt;br /&gt;
         self.q.enqueue (1)&lt;br /&gt;
         self.q.enqueue (2)&lt;br /&gt;
         self.q.enqueue (3)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),1)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),2)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),3)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
마지막 한가지. dequeue 를 구현할때 예상했던 일중 하나인 갯수를 세어보자.&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def setUp (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
     def testEnqueue (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.last(), 10)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.last(), 20)&lt;br /&gt;
     &lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.count(), 1)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.count(), 2)&lt;br /&gt;
         self.q.enqueue (30)&lt;br /&gt;
         self.assertEquals (self.q.count(), 3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueData (self):&lt;br /&gt;
         self.q.enqueue (1)&lt;br /&gt;
         self.q.enqueue (2)&lt;br /&gt;
         self.q.enqueue (3)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),1)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),2)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueCount (self):&lt;br /&gt;
         self.q.enqueue (1)&lt;br /&gt;
         self.q.enqueue (2)&lt;br /&gt;
         self.q.enqueue (3)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),2)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),1)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),0)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
 ----------------------------------------------------------------------&lt;br /&gt;
 Ran 4 tests in 0.050s&lt;br /&gt;
 &lt;br /&gt;
 OK&lt;br /&gt;
&lt;br /&gt;
완성코드..&lt;br /&gt;
TestCaseQueue.py&lt;br /&gt;
 import unittest&lt;br /&gt;
 from queue import Queue&lt;br /&gt;
 &lt;br /&gt;
 class QueueTestCase (unittest.TestCase):&lt;br /&gt;
     def setUp (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
     def testEnqueue (self):&lt;br /&gt;
         self.q = Queue ()&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.last(), 10)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.last(), 20)&lt;br /&gt;
     &lt;br /&gt;
     def testCount (self):&lt;br /&gt;
         self.q.enqueue (10)&lt;br /&gt;
         self.assertEquals (self.q.count(), 1)&lt;br /&gt;
         self.q.enqueue (20)&lt;br /&gt;
         self.assertEquals (self.q.count(), 2)&lt;br /&gt;
         self.q.enqueue (30)&lt;br /&gt;
         self.assertEquals (self.q.count(), 3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueData (self):&lt;br /&gt;
         self.q.enqueue (1)&lt;br /&gt;
         self.q.enqueue (2)&lt;br /&gt;
         self.q.enqueue (3)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),1)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),2)&lt;br /&gt;
         self.assertEquals (self.q.dequeue(),3)&lt;br /&gt;
 &lt;br /&gt;
     def testDequeueCount (self):&lt;br /&gt;
         self.q.enqueue (1)&lt;br /&gt;
         self.q.enqueue (2)&lt;br /&gt;
         self.q.enqueue (3)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),2)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),1)&lt;br /&gt;
         self.q.dequeue ()&lt;br /&gt;
         self.assertEquals (self.q.count(),0)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 suite = unittest.makeSuite (QueueTestCase, &amp;quot;test&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 runner = unittest.TextTestRunner ()&lt;br /&gt;
 runner.run (suite)&lt;br /&gt;
Queue.py&lt;br /&gt;
 class Queue:&lt;br /&gt;
     def __init__ (self):&lt;br /&gt;
         self.qu_list = []&lt;br /&gt;
     &lt;br /&gt;
     def enqueue (self, n):&lt;br /&gt;
         self.qu_list.append(n)&lt;br /&gt;
 &lt;br /&gt;
     def count (self):&lt;br /&gt;
         return len (self.qu_list)&lt;br /&gt;
 &lt;br /&gt;
     def last (self):&lt;br /&gt;
         return self.qu_list[len(self.qu_list)-1]&lt;br /&gt;
 &lt;br /&gt;
     def dequeue (self):&lt;br /&gt;
         return self.qu_list.pop(0)&lt;br /&gt;
&lt;br /&gt;
Python Shell 에서 써먹어보자.&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; import queue&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q = queue.Queue ()&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.enqueue (10)&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.enqueue (20)&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.enqueue (30)&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.dequeue ()&lt;br /&gt;
 10&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.dequeue ()&lt;br /&gt;
 20&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; q.dequeue ()&lt;br /&gt;
 30&lt;br /&gt;
 &amp;amp;gt;&amp;amp;gt;&amp;amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== TestCode 먼저 만들기 &amp;amp; 코드 키워나가기 ===&lt;br /&gt;
TestFirstProgramming의 핵심은 테스트프로그램을 먼저 작성함으로서 &amp;#039;무엇을 해야 할것인가&amp;#039; 에 대한 촛점을 분명이 한다는 점에 있다. 일단 테스트를 만들고 모듈은 비워둔다. 테스트를 함으로서 에러가 난다. 즉, 인터프리터 또는 컴파일러가 모듈을 요구한다. 모듈을 채운다. 테스트가 failure가 난다. 모듈의 알고리즘이 제대로 되지 않았다는 뜻이다. 테스트를 통과할때까지 프로그래밍 한다.&lt;br /&gt;
&lt;br /&gt;
단, 테스트코드도 처음부터 완벽하게 모든 경우를 생각할 순 없다. 생각할 수 있는 가장 단순한 것부터 한가지씩 생각해 나간다. 복잡하면 나눈다. Divide &amp;amp; Conquer 한다.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[TestFirstProgramming]]&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;Unknown</name></author>
	</entry>
</feed>