<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de-CH">
	<id>https://giswiki.ch/index.php?action=history&amp;feed=atom&amp;title=Diskussion%3AKurs_Python_richtig_lernen%2FUnit_Testing</id>
	<title>Diskussion:Kurs Python richtig lernen/Unit Testing - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://giswiki.ch/index.php?action=history&amp;feed=atom&amp;title=Diskussion%3AKurs_Python_richtig_lernen%2FUnit_Testing"/>
	<link rel="alternate" type="text/html" href="https://giswiki.ch/index.php?title=Diskussion:Kurs_Python_richtig_lernen/Unit_Testing&amp;action=history"/>
	<updated>2026-04-28T23:48:28Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Geometa Lab OST</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://giswiki.ch/index.php?title=Diskussion:Kurs_Python_richtig_lernen/Unit_Testing&amp;diff=41368&amp;oldid=prev</id>
		<title>Mrueegg am 12. September 2012 um 13:54 Uhr</title>
		<link rel="alternate" type="text/html" href="https://giswiki.ch/index.php?title=Diskussion:Kurs_Python_richtig_lernen/Unit_Testing&amp;diff=41368&amp;oldid=prev"/>
		<updated>2012-09-12T13:54:42Z</updated>

		<summary type="html">&lt;p&gt;&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;de-CH&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 12. September 2012, 13:54 Uhr&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-l68&quot;&gt;Zeile 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 68:&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 test_eq():&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 test_eq():&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;assert &lt;/del&gt;Rational(2, 3) == &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Rational(2, 3)&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;     &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;r = &lt;/ins&gt;Rational(2, 3)&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;     assert Rational(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3&lt;/del&gt;) &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;!&lt;/del&gt;= &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Rational(1, 3)&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    assert r &lt;/ins&gt;== &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;r&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;     assert Rational(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;4&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;6&lt;/ins&gt;) =&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= r&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 colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;def test_neq():&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;    assert Rational(3, 4) != Rational(2, 3)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&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 test_float():&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 test_float():&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;     assert 0.75 == float(Rational(3, 4))&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;     assert 0.75 == float(Rational(3, 4))&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;&amp;lt;/nowiki&amp;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;&amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mrueegg</name></author>
	</entry>
	<entry>
		<id>https://giswiki.ch/index.php?title=Diskussion:Kurs_Python_richtig_lernen/Unit_Testing&amp;diff=41367&amp;oldid=prev</id>
		<title>Mrueegg: Die Seite wurde neu angelegt: „=== Aufgabe 1 ===   &lt;nowiki&gt; from src.bank import BankAccount from nose.tools import raises   def test_deposit_on_empty_account():     b = BankAccount()     b.dep…“</title>
		<link rel="alternate" type="text/html" href="https://giswiki.ch/index.php?title=Diskussion:Kurs_Python_richtig_lernen/Unit_Testing&amp;diff=41367&amp;oldid=prev"/>
		<updated>2012-09-12T13:45:25Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „=== Aufgabe 1 ===   &amp;lt;nowiki&amp;gt; from src.bank import BankAccount from nose.tools import raises   def test_deposit_on_empty_account():     b = BankAccount()     b.dep…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Aufgabe 1 ===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
from src.bank import BankAccount&lt;br /&gt;
from nose.tools import raises&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def test_deposit_on_empty_account():&lt;br /&gt;
    b = BankAccount()&lt;br /&gt;
    b.deposit(100)&lt;br /&gt;
    assert b.balance == 100&lt;br /&gt;
    &lt;br /&gt;
def test_deposit_with_initial_balance():&lt;br /&gt;
    b = BankAccount(10)&lt;br /&gt;
    b.deposit(100)&lt;br /&gt;
    assert b.balance == 110&lt;br /&gt;
&lt;br /&gt;
@raises(ValueError)&lt;br /&gt;
def test_withdraw_with_too_high_amount():&lt;br /&gt;
    b = BankAccount(10)&lt;br /&gt;
    b.withdraw(100)&lt;br /&gt;
&lt;br /&gt;
def test_withdraw_ok():&lt;br /&gt;
    b = BankAccount(110)&lt;br /&gt;
    b.withdraw(100)&lt;br /&gt;
    assert b.balance == 10&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aufgabe 2 ===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
from src.rational import *&lt;br /&gt;
from nose.tools import raises&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
def test_gcd():&lt;br /&gt;
    assert gcd(4, 4) == 4&lt;br /&gt;
    assert gcd(4, 2) == 2&lt;br /&gt;
    assert gcd(3, 6) == 3&lt;br /&gt;
    assert gcd(12, 9) == 3&lt;br /&gt;
    &lt;br /&gt;
@raises(ValueError)&lt;br /&gt;
def test_zero_denominator_raises_error():&lt;br /&gt;
    Rational(3, 0)&lt;br /&gt;
    &lt;br /&gt;
def test_add():&lt;br /&gt;
    r1 = Rational(7, 3)&lt;br /&gt;
    r2 = Rational(6, 3)&lt;br /&gt;
    assert Rational(13, 3) == r1 + r2&lt;br /&gt;
&lt;br /&gt;
def test_sub():&lt;br /&gt;
    r1 = Rational(12, 3)&lt;br /&gt;
    r2 = Rational(6, 3)&lt;br /&gt;
    assert Rational(2, 1) == r1 - r2&lt;br /&gt;
    &lt;br /&gt;
def test_mul():&lt;br /&gt;
    r1 = Rational(2, 3)&lt;br /&gt;
    r2 = Rational(4, 3)&lt;br /&gt;
    assert Rational(8, 9) == r1 * r2&lt;br /&gt;
    &lt;br /&gt;
def test_div():&lt;br /&gt;
    r1 = Rational(2, 3)&lt;br /&gt;
    r2 = Rational(4, 3)&lt;br /&gt;
    assert Rational(1, 2) == r1 / r2&lt;br /&gt;
&lt;br /&gt;
def test_str():&lt;br /&gt;
    assert &amp;quot;2/3&amp;quot; == str(Rational(2, 3))&lt;br /&gt;
    &lt;br /&gt;
def test_eq():&lt;br /&gt;
    assert Rational(2, 3) == Rational(2, 3)&lt;br /&gt;
    assert Rational(2, 3) != Rational(1, 3)&lt;br /&gt;
    &lt;br /&gt;
def test_float():&lt;br /&gt;
    assert 0.75 == float(Rational(3, 4))&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mrueegg</name></author>
	</entry>
</feed>