How to use when_called_with method in assertpy

Best Python code snippet using assertpy_python

test_dziennik_ap.py

Source:test_dziennik_ap.py Github

copy

Full Screen

...21 22 def test_dodaj_ucznia_sukces_2(self):23 assert_that(self.temp.dodaj_ucznia(5, 'Maciej', 'Kowalski')).is_iterable24 def test_dodaj_ucznia_istniejace_id(self):25 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 1, 'Imie', 'Nazwisko')26 27 def test_dodaj_ucznia_nieprawidlowy_typ_id(self):28 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( [], 'Imie', 'Nazwisko')29 30 def test_dodaj_ucznia_nieprawidlowy_typ_id_2(self):31 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 3.4, 'Imie', 'Nazwisko')32 def test_dodaj_ucznia_puste_imie(self):33 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 7, '', 'Nazwisko')34 def test_dodaj_ucznia_puste_nazwisko(self):35 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 7, 'Imie', '')36 37 def test_dodaj_ucznia_nieprawidlowy_typ_imienia(self):38 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 4, 456, 'Nazwisko')39 40 def test_dodaj_ucznia_nieprawidlowy_typ_nazwiska(self):41 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( 4,'Imie', {})42 43 def test_dodaj_ucznia_nieprawidlowy_typ_argumentow(self):44 assert_that(self.temp.dodaj_ucznia).raises(ValueError).when_called_with( [], None, {})45 46 def test_usun_ucznia_sukces(self):47 assert_that(self.temp.usun_ucznia(3)).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}])48 def test_usun_ucznia_sukces_2(self):49 assert_that(self.temp.usun_ucznia(1)).does_not_contain({'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []})50 51 def test_usun_ucznia_sukces_3(self):52 assert_that(self.temp.usun_ucznia(2)[1]).does_not_contain_value(2)53 def test_usun_ucznia_nieistniejace_id(self):54 assert_that(self.temp.usun_ucznia).raises(ValueError).when_called_with(54)55 56 def test_usun_ucznia_nieprawidlowy_typ_id(self):57 assert_that(self.temp.usun_ucznia).raises(ValueError).when_called_with({})58 59 def test_usun_ucznia_nieprawidlowy_typ_id_2(self):60 assert_that(self.temp.usun_ucznia).raises(ValueError).when_called_with(45345.5676786786)61 62 def test_edytuj_ucznia_sukces(self):63 assert_that(self.temp.edytuj_ucznia(3, 'Jan', 'Nowak')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Jan', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])64 def test_edytuj_ucznia_sukces_2(self):65 assert_that(self.temp.edytuj_ucznia(1, 'Daria', 'Kowalska')).is_not_equal_to(self.temp)66 def test_edytuj_ucznia_nieistniejace_id(self):67 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(54,'noweImie', 'noweNazwisko')68 69 def test_edytuj_ucznia_nieprawidlowy_typ_id(self):70 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(True,'noweImie', 'noweNazwisko')71 72 def test_edytuj_ucznia_nieprawidlowy_typ_id_2(self):73 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(5645465487.456342423,'noweImie', 'noweNazwisko')74 75 def test_edytuj_ucznia_nieprawidlowy_typ_imienia(self):76 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(2 , 4353543, 'noweNazwisko')77 78 def test_edytuj_ucznia_nieprawidlowy_typ_nazwiska(self):79 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(2 , 'noweImie', None)80 def test_edytuj_ucznia_puste_nowe_imie(self):81 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(2,'', 'noweNazwisko')82 def test_edytuj_ucznia_puste_nowe_nazwisko(self):83 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(2,'noweImie', '')84 85 def test_edytuj_ucznia_nieprawidlowy_typ_argumentow(self):86 assert_that(self.temp.edytuj_ucznia).raises(ValueError).when_called_with(True , {} , None)87 88 def test_dodaj_przedmiot_sukces(self):89 assert_that(self.temp.dodaj_przedmiot(3, 'j. polski')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [{'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Uwaga'}]}])90 91 def test_dodaj_przedmiot_sukces_2(self):92 assert_that(self.temp.dodaj_przedmiot(1, 'informatyka')).is_not_equal_to(self.temp)93 def test_dodaj_przedmiot_sukces_3(self):94 assert_that(self.temp.dodaj_przedmiot(3, 'muzyka')).ma_przedmiot( 3, 'muzyka')95 def test_dodaj_przedmiot_nieistniejace_id(self):96 assert_that(self.temp.dodaj_przedmiot).raises(ValueError).when_called_with(45567566, 'j. polski')97 98 def test_dodaj_przedmiot_nieprawidlowy_typ_id(self):99 assert_that(self.temp.dodaj_przedmiot).raises(ValueError).when_called_with(54.556546, 'j. polski')100 101 def test_dodaj_przedmiot_nieprawidlowy_typ_id_2(self):102 assert_that(self.temp.dodaj_przedmiot).raises(ValueError).when_called_with(True, 'j. polski')103 104 def test_dodaj_przedmiot_nieprawidlowy_przedmiot(self):105 assert_that(self.temp.dodaj_przedmiot).raises(ValueError).when_called_with(True, 'sdfsdfsf')106 107 def test_dodaj_przedmiot_nieprawidlowy_przedmiot_2(self):108 assert_that(self.temp.dodaj_przedmiot).raises(ValueError).when_called_with(True, {})109 110 def test_edytuj_przedmiot_sukces(self):111 assert_that(self.temp.edytuj_przedmiot(1, 'matematyka', 'informatyka')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'informatyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])112 113 def test_edytuj_przedmiot_sukces_2(self):114 assert_that(self.temp.edytuj_przedmiot(2, 'j. polski', 'plastyka')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'plastyka', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])115 def test_edytuj_przedmiot_nieprawidlowy_przedmiot(self):116 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with(2, 'sdfsdfsf', 'biologia')117 118 def test_edytuj_przedmiot_nieprawidlowy_przedmiot_2(self):119 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with(2, None, 'matematyka')120 121 def test_edytuj_przedmiot_nieistniejace_id(self):122 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with(546455675464, 'matematyka', 'informatyka')123 124 def test_edytuj_przedmiot_nieprawidlowe_id(self):125 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with('dfgfdg', 'matematyka', 'informatyka')126 127 def test_edytuj_przedmiot_nieistniejacy_przedmiot(self):128 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with( 3, 'matematyka', 'informatyka')129 130 def test_edytuj_przedmiot_nieprawidlowy_nowy_przedmiot(self):131 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with( 1, 'matematyka', 'sdfdsf')132 133 def test_edytuj_przedmiot_nieprawidlowy_nowy_przedmiot_2(self):134 assert_that(self.temp.edytuj_przedmiot).raises(ValueError).when_called_with( 2, 'matematyka', [])135 136 def test_usun_przedmiot_sukces(self):137 assert_that(self.temp.usun_przedmiot(2, 'matematyka')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}],)138 def test_usun_przedmiot_sukces_2(self):139 assert_that(self.temp.usun_przedmiot(1, 'matematyka')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])140 141 def test_usun_przedmiot_nieistniejace_id(self):142 assert_that(self.temp.usun_przedmiot).raises(ValueError).when_called_with(54, 'matematyka')143 144 def test_usun_przedmiot_nieistniejacy_przedmiot(self):145 assert_that(self.temp.usun_przedmiot).raises(ValueError).when_called_with(3, 'matematyka')146 147 def test_usun_przedmiot_nieprawidlowy_przedmiot(self):148 assert_that(self.temp.usun_przedmiot).raises(ValueError).when_called_with(3, 'dgfdgfdg')149 150 def test_usun_przedmiot_nieprawidlowe_id(self):151 assert_that(self.temp.usun_przedmiot).raises(ValueError).when_called_with({}, 'matematyka')152 153 def test_usun_przedmiot_nieprawidlowe_argumenty(self):154 assert_that(self.temp.usun_przedmiot).raises(ValueError).when_called_with(None, 'dfgfdg')155 156 def test_dodaj_ocene_sukces(self):157 assert_that(self.temp.dodaj_ocene(1, 'matematyka', 1)).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1, 1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}],)158 def test_dodaj_ocene_sukces_2(self):159 assert_that(self.temp.dodaj_ocene(2, 'matematyka', 5)).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6, 5]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])160 161 def test_dodaj_ocene_nieistniejace_id(self):162 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(54, 'matematyka', 2)163 164 def test_dodaj_ocene_nieprawidlowe_id(self):165 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with([], 'matematyka', 2)166 167 def test_dodaj_ocene_nieprawidlowa_ocena(self):168 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(2, 'matematyka', '56464')169 170 def test_dodaj_ocene_nieprawidlowa_ocena_2(self):171 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(2, 'matematyka', 5.75)172 173 def test_dodaj_ocene_nieistniejacy_przedmiot(self):174 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(1, 'j. polski', 2)175 176 def test_dodaj_ocene_nieprawidlowy_przedmiot(self):177 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(1, 'dfgfdgfdg', 2)178 179 def test_dodaj_ocene_nieprawidlowe_argumenty(self):180 assert_that(self.temp.dodaj_ocene).raises(ValueError).when_called_with(44565.456456, 'dfgfdgfdg', {})181 182 def test_edytuj_oceny_sukces(self):183 assert_that(self.temp.edytuj_oceny(1, 'matematyka', [1,1,1,1])).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1, 1, 1, 1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])184 185 def test_edytuj_oceny_sukces_2(self):186 assert_that(self.temp.edytuj_oceny(2, 'j. polski', [6, 6, 4])).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': [6, 6, 4]}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}]}])187 188 def test_edytuj_oceny_nieprawidlowe_oceny(self):189 assert_that(self.temp.edytuj_oceny).raises(ValueError).when_called_with(1, 'matematyka', [5.75,5.5, 2])190 def test_edytuj_oceny_nieprawidlowe_oceny_2(self):191 assert_that(self.temp.edytuj_oceny).raises(ValueError).when_called_with(1, 'matematyka', [{}, 5, 6])192 193 def test_pokaz_statystyki_ucznia_sukces(self):194 assert_that(self.temp.pokaz_statystyki_przedmiotow(2)).is_equal_to([['matematyka', 5.0], ['j. polski', 0]])195 196 def test_pokaz_statystyki_ucznia_sukces_2(self):197 assert_that(self.temp.pokaz_statystyki_przedmiotow(3)).is_equal_to([])198 199 def test_pokaz_statystyki_ucznia_nieistniejace_id(self):200 assert_that(self.temp.pokaz_statystyki_przedmiotow).raises(ValueError).when_called_with(45456546456)201 202 def test_pokaz_statystyki_ucznia_nieprawidlowe__id(self):203 assert_that(self.temp.pokaz_statystyki_przedmiotow).raises(ValueError).when_called_with(45456546456.45654464)204 205 def test_pokaz_statystyki_ucznia_nieprawidlowe__id_2(self):206 assert_that(self.temp.pokaz_statystyki_przedmiotow).raises(ValueError).when_called_with(None)207 208 def test_pokaz_statystyki_ucznia_przedmiot_sukces(self):209 assert_that(self.temp.pokaz_statystyki_przedmiotu(2, 'matematyka')).is_equal_to([['matematyka', 5.0]])210 211 def test_pokaz_statystyki_ucznia_przedmiot_sukces_2(self):212 assert_that(self.temp.pokaz_statystyki_przedmiotu(2, 'j. polski')).is_equal_to([['j. polski', 0]])213 214 def test_pokaz_statystyki_ucznia_przedmiot_nieistniejace_id(self):215 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with(45456546456, 'matematyka')216 217 def test_pokaz_statystyki_ucznia_przedmiot_nieprawidlowe_id(self):218 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with(45456546456, 'matematyka')219 220 def test_pokaz_statystyki_ucznia_przedmiot_nieprawidlowe_id_2(self):221 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with(6.6699089, 'matematyka')222 223 def test_pokaz_statystyki_ucznia_przedmiot_nieprawidlowy_przedmiot(self):224 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with(1, 'sdfsdf')225 226 def test_pokaz_statystyki_ucznia_przedmiot_nieistniejacy_przedmiot(self):227 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with( 1, 'wychowanie fizyczne')228 229 def test_pokaz_statystyki_ucznia_nieprawidlowe_argumenty(self):230 assert_that(self.temp.pokaz_statystyki_przedmiotu).raises(ValueError).when_called_with({}, None)231 232 def test_dodaj_uwage_sukces(self):233 assert_that(self.temp.dodaj_uwage(3, 'Jest niegrzeczny')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []}, {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]}, {'przedmiot': 'j. polski', 'oceny': []}], 'uwagi': [{'uwaga': 'Źle się zachowuje'}, {'uwaga': 'Jest niegrzeczny'}]}, {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Uwaga'}, {'uwaga': 'Jest niegrzeczny'}]}])234 def test_dodaj_uwage_sukces_2(self):235 assert_that(self.temp.dodaj_uwage(1, 'Przeszkadza na lekcji')).starts_with({'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': [{'uwaga':'Przeszkadza na lekcji'}]})236 237 def test_dodaj_uwage_nieistniejace_id(self):238 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with(4565454, 'Uwaga')239 240 def test_dodaj_uwage_nieprawidlowe_id(self):241 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with(54.566454654, 'Uwaga')242 243 def test_dodaj_uwage_nieprawidlowe_id_2(self):244 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with([], 'Uwaga')245 246 def test_dodaj_uwage_nieprawidlowa_uwaga(self):247 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with( 3, 45456)248 249 def test_dodaj_uwage_nieprawidlowa_uwaga_2(self):250 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with( 3, {})251 def test_dodaj_uwage_pusta_uwaga(self):252 assert_that(self.temp.dodaj_uwage).raises(ValueError).when_called_with( 3, '')253 def test_edytuj_uwage_sukces(self):254 assert_that(self.temp.edytuj_uwage(3, 'Uwaga', 'nowa uwaga')).ends_with({'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'nowa uwaga'}]})255 256 def test_edytuj_uwage_sukces_2(self):257 assert_that(self.temp.edytuj_uwage(2, 'Źle się zachowuje', 'Źle się zachowuje i przeszkadza na lekcji')).is_equal_to([{'id': 1, 'imie': 'Daria', 'nazwisko': 'Pionk',258 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1]}], 'uwagi': []},259 {'id': 2, 'imie': 'Jan', 'nazwisko': 'Kowalski',260 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [6, 3, 6]},261 {'przedmiot': 'j. polski', 'oceny': []}],262 'uwagi': [{'uwaga': 'Źle się zachowuje i przeszkadza na lekcji'}, {'uwaga': 'Jest niegrzeczny'}]},263 {'id': 3, 'imie': 'Kamil', 'nazwisko': 'Nowak', 'przedmioty':264 [], 'uwagi': [{'uwaga': 'Uwaga'}]}])265 266 def test_edytuj_uwage_nieistniejace_id(self):267 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 54, 'uwaga', 'nowa uwaga')268 269 def test_edytuj_uwage_nieprawidlowe_id(self):270 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( None, 'uwaga', 'nowa uwaga')271 272 def test_edytuj_uwage_nieprawidlowe_id_2(self):273 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 6546546.6, 'uwaga', 'nowa uwaga')274 275 def test_edytuj_uwage_nieistniejaca_uwaga(self):276 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with(3, 'sfddsfsff', 'nowa uwaga')277 278 def test_edytuj_uwage_nieprawidlowa_nowa_uwaga(self):279 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 3, 'uwaga', 4569540)280 281 def test_edytuj_uwage_nieprawidlowa_nowa_uwaga_2(self):282 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 3, 'uwaga', ['dfgfdgfd'])283 def test_edytuj_uwage_pusta_uwaga(self):284 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 3, '', 'nowa uwaga')285 def test_edytuj_uwage_pusta_nowa_uwaga(self):286 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 3, 'uwaga', '')287 288 def test_edytuj_uwage_nieprawidlowa_uwaga(self):289 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( 1, {}, 'nowa uwaga')290 291 def test_edytuj_uwage_nieprawidlowe_argumenty(self):292 assert_that(self.temp.edytuj_uwage).raises(ValueError).when_called_with( [], {}, True)293 def test_importuj_dane_sukces(self):294 assert_that(self.temp.importuj_dane('../data/data1.csv')).is_equal_to([{'id': 1, 'imie': 'Jan', 'nazwisko': 'Kowalski', 'przedmioty': [{'przedmiot': 'matematyka', 'oceny': [1, 5, 6]}, {'przedmiot': 'informatyka', 'oceny': [5]}], 'uwagi': []}, {'id': 2, 'imie': 'Maciej', 'nazwisko': 'Nowak', 'przedmioty': [], 'uwagi': [{'uwaga': 'Jest niegrzeczny'}, {'uwaga': 'Przeszkadza na zajeciach'}]}, {'id': 3, 'imie': 'Wojciech', 'nazwisko': 'Przykladowy', 'przedmioty': [{'przedmiot':295'wychowanie fizyczne', 'oceny': [6, 6]}], 'uwagi': [{'uwaga': 'nieprzygotowanie'}]}])296 def test_importuj_dane_sukces_2(self):297 assert_that(self.temp.importuj_dane('../data/data1_1.csv')).is_equal_to([{'id': 2, 'imie': 'Franciszka', 'nazwisko': 'Sienkiewicz', 'przedmioty': [{'przedmiot': 'chemia', 'oceny': [1, 5, 6, 2, 3]}, {'przedmiot': 'plastyka', 'oceny': [5, 1, 2]}], 'uwagi': []}, {'id': 46, 'imie': 'Oliwier', 'nazwisko': 'Stanek', 'przedmioty': [], 'uwagi': [{'uwaga': 'Jest niegrzeczny'}]}, {'id': 2173, 'imie': 'Maurycy', 'nazwisko': 'Kamiński', 'przedmioty': [{'przedmiot': 'wychowanie fizyczne', 'oceny': [6, 6, 6, 6, 6]}, {'przedmiot': 'geografia', 'oceny': [1, 2, 6]}, {'przedmiot': 'wychowanie fizyczne', 'oceny': [6, 6, 6]}], 'uwagi': [{'uwaga': 'nieprzygotowanie'}]}, {'id': 656, 'imie': 'August', 'nazwisko': 'Wrona', 'przedmioty': [], 'uwagi': []}, {'id': 1, 'imie': 'Maciej', 'nazwisko': 'Jeleń', 'przedmioty': [{'przedmiot': 'wychowanie fizyczne', 'oceny': [6, 6]}], 'uwagi': [{'uwaga': 'nieprzygotowanie'}]}],)298 299 def test_importuj_dane_zly_format_pliku(self):300 assert_that(self.temp.importuj_dane).raises(ValueError).when_called_with('sdfsf.jpg')301 def test_importuj_dane_zly_format_pliku_2(self):302 assert_that(self.temp.importuj_dane).raises(ValueError).when_called_with('sdfsf')303 def test_importuj_dane_zly_format_pliku_3(self):304 assert_that(self.temp.importuj_dane).raises(ValueError).when_called_with([])305 def test_importuj_dane_zly_format_pliku_4(self):306 assert_that(self.temp.importuj_dane).raises(ValueError).when_called_with(3)307 def test_eksportuj_dane_sukces(self):308 assert_that(self.temp.eksportuj_dane('../data/data2.csv')).is_equal_to(self.temp.lista_uczniow)309 310 def test_eksportuj_dane_zly_format_pliku(self):311 assert_that( self.temp.eksportuj_dane).raises(ValueError).when_called_with('sdfsf')312 def test_eksportuj_dane_zly_format_pliku_2(self):313 assert_that(self.temp.eksportuj_dane).raises(ValueError).when_called_with([])314 def test_eksportuj_dane_zly_format_pliku_3(self):315 assert_that(self.temp.eksportuj_dane).raises(ValueError).when_called_with(456546)316 def test_eksportuj_dane_zly_format_pliku_4(self):317 assert_that(self.temp.eksportuj_dane).raises(ValueError).when_called_with('dfsdf.mp3')318 def tearDown(self):319 self.temp = None320if __name__ == '__main__':...

Full Screen

Full Screen

test_assertPy.py

Source:test_assertPy.py Github

copy

Full Screen

...21 def test_correct_instance(self):22 assert_that(self.temp).is_instance_of(E_gradebook)2324 def test_assert_student_is_none(self):25 assert_that(self.temp.add_student).raises(TypeError).when_called_with(None)2627 def test_assert_student_is_int(self):28 assert_that(self.temp.add_student).raises(TypeError).when_called_with(10)2930 def test_assert_student_is_dict(self):31 assert_that(self.temp.add_student).raises(TypeError).when_called_with({"student": "Anna"})3233 def test_assert_student_is_list(self):34 assert_that(self.temp.add_student).raises(TypeError).when_called_with(["Kasia"])3536 def test_assert_student_has_full_name(self):37 assert_that(self.temp.add_student).raises(ValueError).when_called_with("Kasia")3839 def test_assert_student_has_full_name_space_before(self):40 assert_that(self.temp.add_student).raises(ValueError).when_called_with(" Kasia")4142 def test_assert_student_has_full_name_space_after(self):43 assert_that(self.temp.add_student).raises(ValueError).when_called_with("Kasia ")4445 def test_add_student_returns_correctly(self):46 self.temp.add_student("Kasia K")47 assert_that(self.temp.students).is_equal_to([[{0: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}]])4849 def test_add_student_returns_correctly_for_5_students(self):50 for x in range(5):51 self.temp.add_student("Kasia K")52 assert_that(self.temp.students).is_equal_to([[{0: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{1: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{2: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{3: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{4: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}]])5354 def test_add_student_returns_correctly_for_10_students(self):55 for x in range(10):56 self.temp.add_student("Kasia K")57 assert_that(self.temp.students).is_equal_to([[{0: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{1: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{2: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{3: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{4: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{5: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{6: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{7: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{8: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}], [{9: 'Kasia K', 'annotations': {}, 'average grades': {}}, {}]])58596061 def test_delete_student_index_is_none(self):62 assert_that(self.temp1.delete_student).raises(TypeError).when_called_with(None)6364 def test_delete_student_index_is_str(self):65 assert_that(self.temp1.delete_student).raises(TypeError).when_called_with("10")6667 def test_delete_student_index_is_dict(self):68 assert_that(self.temp1.delete_student).raises(TypeError).when_called_with({0: 0})6970 def test_delete_student_index_is_list(self):71 assert_that(self.temp1.delete_student).raises(TypeError).when_called_with([0])7273 def test_delete_student_index_is_float(self):74 assert_that(self.temp1.delete_student).raises(TypeError).when_called_with(0.0)7576 def test_delete_student_no_student_with_given_index(self):77 assert_that(self.temp1.delete_student).raises(ValueError).when_called_with(1)7879 def test_delete_student_no_student_with_negative_index(self):80 assert_that(self.temp1.delete_student).raises(ValueError).when_called_with(-1)8182 def test_delete_student_successful(self):83 self.temp1.delete_student(0)84 assert_that(bool(self.temp1.students)).is_false() # checking if value of object is empty after deleting the only student8586 def test_delete_5_students_succesful(self):87 for x in range(4):88 self.temp1.add_student("Kasia K")89 for x in range(5):90 self.temp1.delete_student(x)91 assert_that(bool(self.temp1.students)).is_false()9293 def test_delete_15_students_succesful(self):94 for x in range(14):95 self.temp1.add_student("Kasia K")96 for x in range(15):97 self.temp1.delete_student(x)98 assert_that(bool(self.temp1.students)).is_false()99100 def test_delete_150_students_succesful(self):101 for x in range(149):102 self.temp1.add_student("Kasia K")103 for x in range(150):104 self.temp1.delete_student(x)105 assert_that(bool(self.temp1.students)).is_false()106107 def test_students_is_list_after_deleting(self):108 self.temp1.delete_student(0)109 assert_that(self.temp1.students).is_instance_of(list)110111 def test_assert_edit_student_name_is_none(self):112 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with(None)113114 def test_assert_edit_student_name_is_int(self):115 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with(10)116117 def test_assert_edit_student_name_is_dict(self):118 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with({"student": "Anna"})119120 def test_assert_edit_student_name_is_list(self):121 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with(["Kasia"])122123124125 def test_assert_edit_student_index_is_none(self):126 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with(None)127128 def test_assert_edit_student_index_is_str(self):129 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with("10")130131 def test_assert_edit_student_index_is_dict(self):132 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with({2: "two"})133134 def test_assert_edit_student_index_is_tuple(self):135 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with((0, 0))136137 def test_assert_edit_student_index_is_float(self):138 assert_that(self.temp1.edit_student).raises(TypeError).when_called_with(0.0)139140141 def test_assert_edit_student_successful(self):142 self.temp1.edit_student(0, "Kasia KKK")143 assert_that(self.temp1.students[0][0][0]).is_equal_to("Kasia KKK")144145 def test_edit_5_students_succesful(self):146 for x in range(4):147 self.temp1.add_student("Kasia K")148 for x in range(5):149 self.temp1.edit_student(x, "Kasia KKK")150 assert_that(self.temp1.students[x][0][x]).is_equal_to("Kasia KKK")151152 def test_edit_15_students_succesful(self):153 for x in range(14):154 self.temp1.add_student("Kasia K")155 for x in range(15):156 self.temp1.edit_student(x, "Kasia KKK")157 assert_that(self.temp1.students[x][0][x]).is_equal_to("Kasia KKK")158159 def test_edit_150_students_succesful(self):160 for x in range(149):161 self.temp1.add_student("Kasia K")162 for x in range(150):163 self.temp1.edit_student(x, "Kasia KKK")164 assert_that(self.temp1.students[x][0][x]).is_equal_to("Kasia KKK")165166 def test_edit_student_returns_correct_students_value_1(self):167 self.temp1.edit_student(0, "Kasia KKK")168 assert_that(self.temp1.students).is_equal_to([[{0: 'Kasia KKK', 'annotations': {}, 'average grades': {}}, {}]])169170 def test_edit_student_returns_correct_students_value_2(self):171 self.temp1.edit_student(0, "Kasia KKKKKK")172 assert_that(self.temp1.students).is_equal_to([[{0: 'Kasia KKKKKK', 'annotations': {}, 'average grades': {}}, {}]])173174 def test_edit_student_no_student_with_given_index(self):175 assert_that(self.temp1.edit_student).raises(ValueError).when_called_with(1, "Kasia K")176177 def test_edit_student_no_student_with_negative_index(self):178 assert_that(self.temp1.edit_student).raises(ValueError).when_called_with(-1, "Kasia K")179180 def test_assert_edit_student_has_full_name(self):181 assert_that(self.temp1.edit_student).raises(ValueError).when_called_with(0, "Kasia")182183 def test_assert_edit_student_has_full_name_space_before(self):184 assert_that(self.temp1.edit_student).raises(ValueError).when_called_with(0, " Kasia")185186 def test_assert_edit_student_has_full_name_space_after(self):187 assert_that(self.temp1.edit_student).raises(ValueError).when_called_with(0, "Kasia ")188189190 def test_assert_subject_average_index_is_float(self):191 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0.0, "matma")192193 def test_assert_subject_average_index_is_none(self):194 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(None, "matma")195196 def test_assert_subject_average_index_is_str(self):197 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with("0", "matma")198199 def test_assert_subject_average_index_is_bool(self):200 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(True, "matma")201202 def test_assert_subject_average_index_is_list(self):203 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with([0], "matma")204205 def test_assert_subject_average_subject_is_float(self):206 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0, 0.0)207208 def test_assert_subject_average_subject_is_none(self):209 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0, None)210211 def test_assert_subject_average_subject_is_int(self):212 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0, 0)213214 def test_assert_subject_average_subject_is_bool(self):215 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0, False)216217 def test_assert_subject_average_subject_is_list(self):218 assert_that(self.temp2.subject_average).raises(TypeError).when_called_with(0, ["matma"])219220 def test_assert_subject_average_non_existent_index(self):221 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(1, "matma")222223 def test_assert_subject_average_non_existent_index1(self):224 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(-1, "matma")225226 def test_assert_subject_average_non_existent_index2(self):227 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(100, "matma")228229 def test_assert_subject_average_non_existent_subject(self):230 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(0, "polski")231232 def test_assert_subject_average_non_existent_subject1(self):233 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(0, "MATMA")234235 def test_assert_subject_average_non_existent_subject2(self):236 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(0, " matma")237238 def test_assert_subject_average_non_existent_subject3(self):239 assert_that(self.temp2.subject_average).raises(ValueError).when_called_with(0, "matma ")240241242 def test_assert_subject_average_no_grades(self):243 assert_that(self.temp2.subject_average).raises(Exception).when_called_with(0, "matma") #exception as there are no grades so we would have to divide by zero244245246 def test_assert_subject_average(self):247 self.temp2.add_grade(0, "matma", "spr", 5)248 self.temp2.add_grade(0, "matma", "spr1", 4)249 self.temp2.subject_average(0, "matma")250 assert_that(self.temp2.students[0][0]["average grades"]["average matma grade"]).is_equal_to(4.5)251252 def test_assert_overall_average_index_is_float(self):253 assert_that(self.temp2.overall_average).raises(TypeError).when_called_with(0.0)254255 def test_assert_overall_average_index_is_none(self):256 assert_that(self.temp2.overall_average).raises(TypeError).when_called_with(None)257258 def test_assert_overall_average_index_is_str(self):259 assert_that(self.temp2.overall_average).raises(TypeError).when_called_with("0")260261 def test_assert_overall_average_index_is_bool(self):262 assert_that(self.temp2.overall_average).raises(TypeError).when_called_with(True)263264 def test_assert_overall_average_index_is_list(self):265 assert_that(self.temp2.overall_average).raises(TypeError).when_called_with([0])266267268 def test_assert_overall_average_non_existent_index(self):269 assert_that(self.temp2.overall_average).raises(ValueError).when_called_with(1)270271 def test_assert_overall_average_non_existent_index1(self):272 assert_that(self.temp2.overall_average).raises(ValueError).when_called_with(-1)273274 def test_assert_overall_average_non_existent_index2(self):275 assert_that(self.temp2.overall_average).raises(ValueError).when_called_with(100)276277 def test_assert_overall_average_no_grades(self):278 self.temp2.delete_subject(0, "matma")279 assert_that(self.temp2.overall_average).raises(Exception).when_called_with(0, "matma")280281282 def test_assert_overall_average(self):283 self.temp2.add_subject(0, "polski")284 self.temp2.add_grade(0, "polski", "spr", 4)285 self.temp2.add_grade(0, "matma", "spr", 3)286 self.temp2.add_grade(0, "matma", "spr1", 1)287 self.temp2.overall_average(0)288 assert_that(self.temp2.students[0][0]["overall average"]).is_equal_to(3.0)289290 def test_assert_add_annotation_index_is_float(self):291 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0.0, "zachowanie", "bdb")292293 def test_assert_add_annotation_index_is_none(self):294 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(None, "zachowanie", "bdb")295296 def test_assert_add_annotation_index_is_str(self):297 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with("0", "zachowanie", "bdb")298299 def test_assert_add_annotation_index_is_bool(self):300 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(True, "zachowanie", "bdb")301302 def test_assert_add_annotation_index_is_list(self):303 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with([0], "zachowanie", "bdb")304305 def test_assert_add_annotation_category_is_float(self):306 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, 0.0, "bdb")307308 def test_assert_add_annotation_category_is_none(self):309 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, None, "bdb")310311 def test_assert_add_annotation_category_is_int(self):312 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, 0, "bdb")313314 def test_assert_add_annotation_category_is_bool(self):315 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, False, "bdb")316317 def test_assert_add_annotation_category_is_list(self):318 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, ["matma"], "bdb")319320 def test_assert_add_annotation_content_is_float(self):321 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, "zachowanie", 0.0)322323 def test_assert_add_annotation_content_is_none(self):324 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, "zachowanie", None)325326 def test_assert_add_annotation_content_is_int(self):327 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, "zachowanie", 0)328329 def test_assert_add_annotation_content_is_bool(self):330 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, "zachowanie", True)331332 def test_assert_add_annotation_content_is_list(self):333 assert_that(self.temp2.add_annotation).raises(TypeError).when_called_with(0, "zachowanie", ["bdb"])334335 def test_assert_add_annotation_non_existent_index(self):336 assert_that(self.temp2.add_annotation).raises(ValueError).when_called_with(1, "zachowanie", "bdb")337338 def test_assert_add_annotation_non_existent_index1(self):339 assert_that(self.temp2.add_annotation).raises(ValueError).when_called_with(-1, "zachowanie", "bdb")340341 def test_assert_add_annotation_non_existent_index2(self):342 assert_that(self.temp2.add_annotation).raises(ValueError).when_called_with(100, "zachowanie", "bdb")343344 def test_assert_edit_annotation_index_is_float(self):345 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0.0, "zachowanie", "bdb")346347 def test_assert_edit_annotation_index_is_none(self):348 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(None, "zachowanie", "bdb")349350 def test_assert_edit_annotation_index_is_str(self):351 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with("0", "zachowanie", "bdb")352353 def test_assert_edit_annotation_index_is_bool(self):354 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(True, "zachowanie", "bdb")355356 def test_assert_edit_annotation_index_is_list(self):357 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with([0], "zachowanie", "bdb")358359 def test_assert_edit_annotation_category_is_float(self):360 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, 0.0, "bdb")361362 def test_assert_edit_annotation_category_is_none(self):363 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, None, "bdb")364365 def test_assert_edit_annotation_category_is_int(self):366 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, 0, "bdb")367368 def test_assert_edit_annotation_category_is_bool(self):369 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, False, "bdb")370371 def test_assert_edit_annotation_category_is_list(self):372 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, ["matma"], "bdb")373374 def test_assert_edit_annotation_content_is_float(self):375 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, "zachowanie", 0.0)376377 def test_assert_edit_annotation_content_is_none(self):378 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, "zachowanie", None)379380 def test_assert_edit_annotation_content_is_int(self):381 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, "zachowanie", 0)382383 def test_assert_edit_annotation_content_is_bool(self):384 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, "zachowanie", True)385386 def test_assert_edit_annotation_content_is_list(self):387 assert_that(self.temp2.edit_annotation).raises(TypeError).when_called_with(0, "zachowanie", ["bdb"])388389 def test_assert_edit_annotation_non_existent_index(self):390 assert_that(self.temp2.edit_annotation).raises(ValueError).when_called_with(1, "zachowanie", "bdb")391392 def test_assert_edit_annotation_non_existent_index1(self):393 assert_that(self.temp2.add_annotation).raises(ValueError).when_called_with(-1, "zachowanie", "bdb")394395 def test_assert_edit_annotation_non_existent_index2(self):396 assert_that(self.temp2.edit_annotation).raises(ValueError).when_called_with(100, "zachowanie", "bdb")397398399400 def test_assert_edit_annotation_non_existent_annotation(self):401 self.temp2.add_annotation(0, "zachowanie", "bdb")402 assert_that(self.temp2.edit_annotation).raises(ValueError).when_called_with(1, "ZACHOWANIE", "bdb")403404 def test_assert_edit_annotation_non_existent_annotation1(self):405 self.temp2.add_annotation(0, "zachowanie", "bdb")406 assert_that(self.temp2.add_annotation).raises(ValueError).when_called_with(-1, " zachowanie", "bdb")407408 def test_assert_edit_annotation_non_existent_annotation2(self):409 self.temp2.add_annotation(0, "zachowanie", "bdb")410 assert_that(self.temp2.edit_annotation).raises(ValueError).when_called_with(100, "zachowanie ", "bdb")411412 def test_assert_csv_export_filename_not_correct(self):413 assert_that(self.temp2.csv_export).raises(TypeError).when_called_with(436363)414415 def test_assert_csv_export_filename_not_correct1(self):416 assert_that(self.temp2.csv_export).raises(TypeError).when_called_with(["file"])417418 def test_assert_csv_export_filename_not_csv_file(self):419 assert_that(self.temp2.csv_export).raises(ValueError).when_called_with("file.jpg")420421 def test_assert_csv_import_filename_not_correct(self):422 assert_that(self.temp2.csv_import).raises(TypeError).when_called_with(436363)423424 def test_assert_csv_import_filename_not_correct1(self):425 assert_that(self.temp2.csv_import).raises(TypeError).when_called_with(["file"])426427 def test_assert_csv_import_filename_not_csv_file(self): ...

Full Screen

Full Screen

TestJournalAssertpy.py

Source:TestJournalAssertpy.py Github

copy

Full Screen

...38 (True, 'Id must be an integer'),39 (-3, "Student doesn't exist"),40 ])41 def test_exception_deleteStudent(self, arg, mess):42 assert_that(self.tmp.deleteStudent).raises(Exception).when_called_with(arg).is_equal_to(mess)43 def test_addSubject1(self):44 self.tmp.addSubject(1, 'Matematyka')45 assert_that(self.tmp.students[1]['Subjects']).is_equal_to({'Przyroda':[], 'Matematyka': []})46 def test_addSubject_exception1(self):47 assert_that(self.tmp.addSubject).raises(Exception).when_called_with(3, '').is_equal_to('Empty values are invalid')48 def test_addSubject_exception2(self):49 assert_that(self.tmp.addSubject).raises(Exception).when_called_with(3, 3).is_equal_to('Subject name must be a string')50 def test_addSubject_exception3(self):51 assert_that(self.tmp.addSubject).raises(Exception).when_called_with(6, 'New').is_equal_to("Student doesn't exist")52 def test_addSubject_exception4(self):53 assert_that(self.tmp.addSubject).raises(Exception).when_called_with(True, 'New').is_equal_to('Id must be an integer')54 def test_editSubject2(self):55 self.tmp.editSubject(1, 'Przyroda', 'Matematyka')56 assert_that(self.tmp.students[1]['Subjects']).contains('Matematyka')57 def test_editSubject3(self):58 self.tmp.editSubject(1, 'Przyroda', 'Matematyka')59 assert_that(self.tmp.students[1]['Subjects']).does_not_contain('Przyroda')60 def test_editSubject_exception1(self):61 assert_that(self.tmp.editSubject).raises(Exception).when_called_with(6, 'Przyroda', 'WF').is_equal_to("Student doesn't exist")62 def test_editSubject_exception2(self):63 assert_that(self.tmp.editSubject).raises(Exception).when_called_with(1, 'Matematyka', 'WF').is_equal_to("Subject doesn't exist")64 def test_editSubject_exception4(self):65 assert_that(self.tmp.editSubject).raises(Exception).when_called_with('string', 'Przyroda', 'WF').is_equal_to('Id must be an integer')66 def test_editSubject_exception5(self):67 assert_that(self.tmp.editSubject).raises(Exception).when_called_with(3, 5, 'WF').is_equal_to('Names must be strings')68 def test_editSubject_exception6(self):69 assert_that(self.tmp.editSubject).raises(Exception).when_called_with(3, 'Przyroda', 10).is_equal_to('Names must be strings')70 def test_averageSubject(self):71 assert_that(self.tmp.averageSubject(0, 'Przyroda')).is_close_to(4.33, 0.01)72 def test_averageSubject1(self):73 assert_that(self.tmp.averageSubject(3, 'Przyroda')).is_close_to(3, 0.01)74 @parameterized.expand([75 (True, 'Przyroda', 'Id must be an integer'),76 (6, 'Przyroda', "Student doesn't exist"),77 (0, 'Przyr', "Subject doesn't exist"),78 (0, 3, 'Subject name must be a string')79 ])80 def test_averageSubject_exception(self, studid, subject, mess):81 assert_that(self.tmp.averageSubject).raises(Exception).when_called_with(studid, subject).is_equal_to(mess)82 def test_averageSubject_exception_zero(self):83 assert_that(self.tmp.averageSubject).raises(Exception).when_called_with(1, 'Przyroda')84 def test_averageStudent1(self):85 assert_that(self.tmp.averageStudent(2)).is_close_to(3.58, 0.01)86 def test_averageStudent2(self):87 assert_that(self.tmp.averageStudent(3)).is_close_to(3, 0.01)88 def test_averageStudent3_one_subject(self):89 assert_that(self.tmp.averageStudent(0)).is_close_to(4.33, 0.01)90 def test_averageStudent_exception1(self):91 assert_that(self.tmp.averageStudent).raises(Exception).when_called_with(True).is_equal_to('Id must be an integer')92 def test_averageStudent_exception2(self):93 assert_that(self.tmp.averageStudent).raises(Exception).when_called_with(6).is_equal_to("Student doesn't exist")94 def test_averageStudent_exception4(self):95 assert_that(self.tmp.averageStudent).raises(Exception).when_called_with(1)\96 .is_equal_to("Student's subjects have no grades")97 def tearDown(self):98 self.tmp = None99if __name__ == '__main__':...

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 assertpy 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