Пример #1
0
 def test_sharpie(self):
     sharpie = Sharpie('blue', 10.0, 100.0)
     ink_amount1 = 20.0
     ink_amount2 = 20
     ink_amount3 = 'ink'
     ink_amount4 = 'True'
     self.assertEqual(sharpie.use(ink_amount1), 80.0)
     self.assertEqual(sharpie.use(ink_amount2), 60.0)
     self.assertEqual(sharpie.use(ink_amount3), None)
     self.assertEqual(sharpie.use(ink_amount4), None)
Пример #2
0
class Test_sharpie(unittest.TestCase):
    def setUp(self):
        self.sharpie = Sharpie("green", 3, 200)

    def test_color_of_sharpie(self):
        self.assertEqual(self.sharpie.color, "green")

    def test_width_of_sharpie(self):
        self.assertEqual(self.sharpie.width, float(3))

    def test_ink_amount_of_sharpie(self):
        self.assertEqual(self.sharpie.ink_amount, float(200))

    def test_use(self):
        self.sharpie.use()
        self.assertEqual(self.sharpie.ink_amount, float(199))
Пример #3
0
from sharpie import Sharpie

red_sharpie = Sharpie("red", 1.3)
red_sharpie.use()
print(red_sharpie.get_ink())

print(red_sharpie.get_color())
red_sharpie.set_color("green")
print(red_sharpie.get_color())
Пример #4
0
sharpie_set = SharpieSet()

zold_sharpie = Sharpie('zöld', 1)
kek_sharpie = Sharpie('kék', 2)
piros_sharpie = Sharpie('piros', 4)
rozsaszin_sharpie = Sharpie('rózsaszín', 5)

sharpie_set.add(zold_sharpie)
sharpie_set.add(kek_sharpie)
sharpie_set.add(piros_sharpie)
sharpie_set.add(rozsaszin_sharpie)

#print(sharpie_set.count_usable())

zold_sharpie.use()
kek_sharpie.use()
piros_sharpie.use()
rozsaszin_sharpie.use()

# print(zold_sharpie.tinta_mennyiseg)
# print(kek_sharpie.tinta_mennyiseg)
# print(piros_sharpie.tinta_mennyiseg)
# print(rozsaszin_sharpie.tinta_mennyiseg)

kek_sharpie.tinta_mennyiseg = 1
piros_sharpie.tinta_mennyiseg = 1

kek_sharpie.use()
piros_sharpie.use()
print(kek_sharpie.tinta_mennyiseg)
Пример #5
0
from sharpie_set import Sharpie_set
from sharpie import Sharpie

green = Sharpie("green", 0.1)
red = Sharpie("red", 0.2)
orange = Sharpie("orange", 0.3)

new_set = Sharpie_set()

green.use()

new_set.add(green)
new_set.add(red)
new_set.add(orange)

print(new_set.count_usable())

Пример #6
0
 def test_use(self):
     test_use = Sharpie('color', 1)
     self.assertEqual(test_use.use(), Sharpie('color', 1).ink_amount - 0.5)
Пример #7
0
from sharpie import Sharpie
from sharpieSet import SharpieSet

tolltarto = SharpieSet()
print(tolltarto.sharpies)

# példányosítunk 2 filcet:
sarga = Sharpie('sárga', 4.5)
kek = Sharpie('kék', 2)

# hozzáadjuk a tolltartohoz
tolltarto.add(sarga)
tolltarto.add(kek)
print(tolltarto.sharpies)

# a sárgát használjuk 100-szor, kiürül
for _ in range(100):
    sarga.use()

print('hasznalhato filcek: ' + str(tolltarto.count_usable()))

tolltarto.remove_trash()

# már csak a kék van a tolltartóban:
for sharpie in tolltarto.sharpies:
    print(sharpie.szin)