Skip to content

Commit

Permalink
Turns out has_data isn't used by anyone
Browse files Browse the repository at this point in the history
  • Loading branch information
the-other-james committed Sep 21, 2023
1 parent 642da08 commit 65e0a88
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 60 deletions.
7 changes: 0 additions & 7 deletions onair/data_handling/csv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,3 @@ def get_next(self):
# Return whether or not the index has finished traveling through the data
def has_more(self):
return self.frame_index < len(self.sim_data)

# Return whether or not there is data
# TODO: This function may be removed with future clean-up
def has_data(self):
if self.sim_data == []:
return False
return True
7 changes: 0 additions & 7 deletions onair/data_handling/on_air_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,3 @@ def has_more(self):
Used by file-based data to indicate if there are more frames (True) or if the end of the file has been reached (False)
"""
raise NotImplementedError

@abstractmethod
def has_data(self):
"""
Used by live telemetry sources to indicate if new data has come in
"""
raise NotImplementedError
29 changes: 0 additions & 29 deletions test/onair/data_handling/test_csv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,32 +346,3 @@ def test_CSV_has_more_returns_false_when_index_equal_than_number_of_frames(setup

# Assert
assert result == expected_result

# CSV has_data test
def test_CSV_has_data_returns_true_sim_data_is_non_empty(setup_teardown):
# Arrange
fake_sim_data = MagicMock()

expected_result = True

pytest.cut.sim_data = fake_sim_data

# Act
result = pytest.cut.has_data()

# Assert
assert result == expected_result

def test_CSV_has_data_returns_false_sim_data_is_empty(setup_teardown):
# Arrange
fake_sim_data = []

expected_result = False

pytest.cut.sim_data = fake_sim_data

# Act
result = pytest.cut.has_data()

# Assert
assert result == expected_result
17 changes: 0 additions & 17 deletions test/onair/data_handling/test_on_air_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def get_next(self):
def has_more(self):
return super().has_more()

def has_data(self):
return super().has_data()

class IncompleteOnAirDataSource(OnAirDataSource):
pass

Expand All @@ -47,9 +44,6 @@ def get_next(self):
def has_more(self):
return super().has_more()

def has_data(self):
return super().has_data()

@pytest.fixture
def setup_teardown():
pytest.cut = FakeOnAirDataSource.__new__(FakeOnAirDataSource)
Expand Down Expand Up @@ -101,7 +95,6 @@ def test_OnAirDataSource_raises_error_because_of_unimplemented_abstract_methods(
assert "parse_meta_data_file" in e_info.__str__()
assert "get_next" in e_info.__str__()
assert "has_more" in e_info.__str__()
assert "has_data" in e_info.__str__()

# Incomplete plugin call tests
def test_OnAirDataSource_raises_error_when_an_inherited_class_is_instantiated_because_abstract_methods_are_not_implemented_by_that_class():
Expand All @@ -116,7 +109,6 @@ def test_OnAirDataSource_raises_error_when_an_inherited_class_is_instantiated_be
assert "parse_meta_data_file" in e_info.__str__()
assert "get_next" in e_info.__str__()
assert "has_more" in e_info.__str__()
assert "has_data" in e_info.__str__()

def test_OnAirDataSource_raises_error_when_an_inherited_class_calls_abstract_method_process_data_file():
# Act
Expand Down Expand Up @@ -153,12 +145,3 @@ def test_OnAirDataSource_raises_error_when_an_inherited_class_calls_abstract_met
with pytest.raises(NotImplementedError) as e_info:
cut.has_more()
assert "NotImplementedError" in e_info.__str__()

def test_OnAirDataSource_raises_error_when_an_inherited_class_calls_abstract_method_has_data():
# Act
cut = BadFakeOnAirDataSource.__new__(BadFakeOnAirDataSource)

# populate list with the functions that should raise exceptions when called.
with pytest.raises(NotImplementedError) as e_info:
cut.has_data()
assert "NotImplementedError" in e_info.__str__()

0 comments on commit 65e0a88

Please sign in to comment.