Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove assertEqual(s) #1628

Merged
merged 7 commits into from
Feb 23, 2022
Merged

fix: remove assertEqual(s) #1628

merged 7 commits into from
Feb 23, 2022

Conversation

razvan-pro
Copy link
Collaborator

@razvan-pro razvan-pro commented Feb 23, 2022

This change is Reviewable

@razvan-pro razvan-pro self-assigned this Feb 23, 2022
Copy link
Member

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 35 unresolved discussions (waiting on @razvan-pro)

a discussion (no related file):
I mentioned the other basic asserts and left out the custom ones.
Also the tests seem to be failing



aimmo/tests/test_views.py, line 110 at r1 (raw file):

        response = c.get(reverse("kurono/code", kwargs={"id": 1}))
        assert response.status_code == 200
        self.assertJSONEqual(

Saw this but dunno if there's a way to convert this one


aimmo/tests/test_views.py, line 148 at r1 (raw file):

        response = c.get(reverse("kurono/play", kwargs={"id": 1}))
        assert response.status_code == 200
        self.assertFalse(response.context["active"])

assert not


aimmo/tests/test_views.py, line 161 at r1 (raw file):

        c = Client()
        response = c.get(reverse("kurono/game_user_details", kwargs={"id": 1}))
        self.assertJSONEqual(response.content, self.EXPECTED_GAMES)

Another one here


aimmo/tests/test_views.py, line 433 at r1 (raw file):

        response = c.get(reverse("game-list"))

        self.assertJSONEqual(response.content, expected_game_list)

Another one here


aimmo/tests/test_views.py, line 573 at r1 (raw file):

        response = c.get(reverse("game-running"))

        self.assertJSONEqual(response.content, expected_game_list)

Another one here


aimmo-game/tests/test_simulation/test_cell.py, line 24 at r1 (raw file):

        cell1 = Cell(1)
        cell2 = Cell(2)
        self.assertNotEqual(cell1, cell2)

this one :)


aimmo-game/tests/test_simulation/test_direction.py, line 43 at r1 (raw file):

        d1 = Direction(0, 1)
        l1 = Location(0, 1)
        self.assertFalse(d1 == l1)

assertFalse


aimmo-game/tests/test_simulation/test_effects.py, line 36 at r1 (raw file):

            for _ in range(10):
                self.effect.on_turn()
            self.assertTrue(self.effect.is_expired)

assertTrue


aimmo-game/tests/test_simulation/test_location.py, line 13 at r1 (raw file):

        loc_2 = Location(3, 3)
        assert loc_1 == loc_2
        self.assertFalse(loc_1 != loc_2)

here


aimmo-game/tests/test_simulation/test_location.py, line 18 at r1 (raw file):

        loc_1 = Location(3, 3)
        loc_2 = Location(4, 3)
        self.assertNotEqual(loc_1, loc_2)

here


aimmo-game/tests/test_simulation/test_location.py, line 19 at r1 (raw file):

        loc_2 = Location(4, 3)
        self.assertNotEqual(loc_1, loc_2)
        self.assertFalse(loc_1 == loc_2)

here


aimmo-game/tests/test_simulation/test_location.py, line 24 at r1 (raw file):

        loc_1 = Location(4, 4)
        loc_2 = Location(4, 3)
        self.assertNotEqual(loc_1, loc_2)

here


aimmo-game/tests/test_simulation/test_location.py, line 25 at r1 (raw file):

        loc_2 = Location(4, 3)
        self.assertNotEqual(loc_1, loc_2)
        self.assertFalse(loc_1 == loc_2)

here


aimmo-game/tests/test_simulation/test_map_generator.py, line 82 at r1 (raw file):

            self.assertLessEqual(c.location.y, 2)
            self.assertGreaterEqual(c.location.x, -1)
            self.assertGreaterEqual(c.location.y, -1)

LOL

Code quote:

            self.assertLessEqual(c.location.x, 1)
            self.assertLessEqual(c.location.y, 2)
            self.assertGreaterEqual(c.location.x, -1)
            self.assertGreaterEqual(c.location.y, -1)

aimmo-game/tests/test_simulation/test_map_generator.py, line 92 at r1 (raw file):

        m = self.get_map()
        obstacle_cells = [cell for cell in m.all_cells() if not cell.habitable]
        self.assertGreaterEqual(len(obstacle_cells), 1)

lol


aimmo-game/tests/test_simulation/test_map_generator.py, line 113 at r1 (raw file):

        habitable_edge_cells = [cell for cell in edge_cells if cell.habitable]

        self.assertGreaterEqual(len(habitable_edge_cells), 1)

lol


aimmo-game/tests/test_simulation/test_world_map.py, line 68 at r1 (raw file):

        assert len(cell_list) == 4
        self.assertTrue(isinstance(cell_list[0], MockCell))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 80 at r1 (raw file):

        assert len(interactable_list) == 1
        self.assertTrue(isinstance(interactable_list[0].interactable, _Interactable))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 92 at r1 (raw file):

        assert len(score_list) == 1
        self.assertTrue(isinstance(score_list[0].interactable, ScoreLocation))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 104 at r1 (raw file):

        assert len(pickup_list) == 1
        self.assertTrue(isinstance(pickup_list[0].interactable, ALL_PICKUPS))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 135 at r1 (raw file):

        cells = list(world_map.score_cells())
        self.assertIn(score_cell1, cells)
        self.assertIn(score_cell2, cells)

these

Code quote:

        self.assertIn(score_cell1, cells)
        self.assertIn(score_cell2, cells)

aimmo-game/tests/test_simulation/test_world_map.py, line 155 at r1 (raw file):

        self.assertNotIn(score_cell, cells, "Score cells should not be spawns")
        self.assertNotIn(unhabitable, cells, "Unhabitable cells should not be spawns")
        self.assertNotIn(filled, cells, "Cells with avatars should not be spawns")

all of these

Code quote:

        self.assertIn(spawnable1, cells)
        self.assertIn(spawnable2, cells)
        self.assertNotIn(score_cell, cells, "Score cells should not be spawns")
        self.assertNotIn(unhabitable, cells, "Unhabitable cells should not be spawns")
        self.assertNotIn(filled, cells, "Cells with avatars should not be spawns")

aimmo-game/tests/test_simulation/test_world_map.py, line 168 at r1 (raw file):

        cells = list(world_map.interactable_cells())
        self.assertIn(pickup_cell1, cells)
        self.assertIn(pickup_cell2, cells)

these

Code quote:

        self.assertIn(pickup_cell1, cells)
        self.assertIn(pickup_cell2, cells)

aimmo-game/tests/test_simulation/test_world_map.py, line 190 at r1 (raw file):

        for x in (0, 1):
            self.assertFalse(world_map.is_on_map(Location(x, -1)))
            self.assertFalse(world_map.is_on_map(Location(x, 2)))

all of these

Code quote:

                self.assertTrue(world_map.is_on_map(Location(x, y)))

        self.assertFalse(world_map.is_on_map(Location(2, 2)))
        self.assertFalse(world_map.is_on_map(Location(-1, 1)))

    def test_x_off_map(self):
        world_map = WorldMap(generate_grid(), self.settings)
        for y in (0, 1):
            self.assertFalse(world_map.is_on_map(Location(-1, y)))
            self.assertFalse(world_map.is_on_map(Location(2, y)))

    def test_y_off_map(self):
        world_map = WorldMap(generate_grid(), self.settings)
        for x in (0, 1):
            self.assertFalse(world_map.is_on_map(Location(x, -1)))
            self.assertFalse(world_map.is_on_map(Location(x, 2)))

aimmo-game/tests/test_simulation/test_world_map.py, line 230 at r1 (raw file):

        world_map = WorldMap(generate_grid(), self.settings)
        target = Location(1, 1)
        self.assertTrue(world_map.can_move_to(target))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 235 at r1 (raw file):

        world_map = WorldMap(generate_grid(), self.settings)
        target = Location(4, 1)
        self.assertFalse(world_map.can_move_to(target))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 241 at r1 (raw file):

        cell = MockCell(target, habitable=False)
        world_map = WorldMap({target: cell}, self.settings)
        self.assertFalse(world_map.can_move_to(target))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 248 at r1 (raw file):

        world_map = WorldMap({target: cell}, self.settings)
        target = Location(0, 0)
        self.assertFalse(world_map.can_move_to(target))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 252 at r1 (raw file):

    def test_empty_grid(self):
        world_map = WorldMap({}, self.settings)
        self.assertFalse(world_map.is_on_map(Location(0, 0)))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 279 at r1 (raw file):

        for x in (0, 1):
            for y in (0, 1):
                self.assertIsNone(world_map.attackable_avatar(Location(x, y)))

here


aimmo-game/tests/test_simulation/test_world_map.py, line 302 at r1 (raw file):

    def test_retrieve_negative(self):
        world_map = WorldMap(generate_grid(3, 3), self.settings)
        self.assertTrue(world_map.is_on_map(Location(-1, -1)))

here


aimmo-game-creator/tests/test_game_manager.py, line 87 at r1 (raw file):

            del mocker.value["1"]
            self.game_manager.update()
        self.assertNotIn(1, self.game_manager.final_games)

here


aimmo-game-creator/tests/test_game_manager.py, line 102 at r1 (raw file):

        token = self.game_manager._generate_game_token()
        self.assertTrue(isinstance(token, str))
        self.assertLessEqual(len(token), TOKEN_MAX_LENGTH)

these

Code quote:

        self.assertTrue(isinstance(token, str))
        self.assertLessEqual(len(token), TOKEN_MAX_LENGTH)

aimmo-game-creator/tests/test_kube_components.py, line 21 at r1 (raw file):

        """
        self.assertIsNotNone(self.secret.metadata)
        self.assertIsNotNone(self.secret.string_data)

these

Code quote:

        self.assertIsNotNone(self.secret.metadata)
        self.assertIsNotNone(self.secret.string_data)

Copy link
Collaborator Author

@razvan-pro razvan-pro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 11 files reviewed, 35 unresolved discussions (waiting on @faucomte97)

a discussion (no related file):

Previously, faucomte97 (Florian Aucomte) wrote…

I mentioned the other basic asserts and left out the custom ones.
Also the tests seem to be failing

Done.



aimmo/tests/test_views.py, line 110 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Saw this but dunno if there's a way to convert this one

Nope


aimmo/tests/test_views.py, line 148 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

assert not

Done.


aimmo/tests/test_views.py, line 161 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Another one here

Nope


aimmo/tests/test_views.py, line 433 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Another one here

Nope


aimmo/tests/test_views.py, line 573 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

Another one here

Nope


aimmo-game/tests/test_simulation/test_cell.py, line 24 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

this one :)

Done.


aimmo-game/tests/test_simulation/test_direction.py, line 43 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

assertFalse

Done.


aimmo-game/tests/test_simulation/test_effects.py, line 36 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

assertTrue

Done.


aimmo-game/tests/test_simulation/test_location.py, line 13 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_location.py, line 18 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_location.py, line 19 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_location.py, line 24 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_location.py, line 25 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_map_generator.py, line 82 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

LOL

Done.


aimmo-game/tests/test_simulation/test_map_generator.py, line 92 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

lol

Done.


aimmo-game/tests/test_simulation/test_map_generator.py, line 113 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

lol

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 68 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 80 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 92 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 104 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 135 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

these

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 155 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

all of these

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 168 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

these

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 190 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

all of these

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 230 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 235 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 241 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 248 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 252 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 279 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game/tests/test_simulation/test_world_map.py, line 302 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game-creator/tests/test_game_manager.py, line 87 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

here

Done.


aimmo-game-creator/tests/test_game_manager.py, line 102 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

these

Done.


aimmo-game-creator/tests/test_kube_components.py, line 21 at r1 (raw file):

Previously, faucomte97 (Florian Aucomte) wrote…

these

Done.

Copy link
Member

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 6 of 8 files at r2, 3 of 3 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @razvan-pro)

Copy link
Member

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @razvan-pro)

@codecov
Copy link

codecov bot commented Feb 23, 2022

Codecov Report

Merging #1628 (0c3a023) into master (89c5020) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1628   +/-   ##
=======================================
  Coverage   67.98%   67.98%           
=======================================
  Files         164      164           
  Lines        3330     3330           
  Branches      280      280           
=======================================
  Hits         2264     2264           
  Misses       1038     1038           
  Partials       28       28           

@razvan-pro razvan-pro merged commit 3ccbb09 into master Feb 23, 2022
@razvan-pro razvan-pro deleted the remove-assertequal branch February 23, 2022 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants